Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Further Notes

Efficiency

The Interactive Matrix Language is an interpretive language executor that can be characterized as follows:

Therefore, you should try to substitute matrix operations for iterative loops. There is a high overhead involved in executing each instruction; however, within the instruction IML runs very efficiently.

Consider four methods of summing the elements of a matrix:

   s=0;                      /* method 1 */
   do i=1 to m;
      do j=1 to n;
         s=s+x[i,j];
      end;
   end;
   s=j[1,m]*x*j[n,1];        /* method 2 */
   s=x[+,+];                 /* method 3 */
   s=sum(x);                 /* method 4 */
Method 1 is the least efficient, method 2 is more efficient, method 3 is more efficient yet, and method 4 is the most efficient. The greatest advantage of using IML is reducing human programming labor.

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.