Understanding the Interactive Matrix Language |
CALL statements invoke a subroutine to perform calculations, operations, or a service. CALL statements are often used in place of functions when the operation returns multiple results or, in some cases, no result. The general form of the CALL statement is as follows:
where arguments can be matrix names, matrix literals, or expressions. If you specify several arguments, use commas to separate them. Also, when using arguments for output results, always use variable names rather than expressions or literals.
call eigen(val,vec,t);
You can program your own subroutine by using the START and FINISH statements to define a module. You can then execute the module with a CALL or RUN statement. For example, the following statements define a module named MYMOD that returns matrices containing the square root and log of each element of the argument matrix:
start mymod(a,b,c); a=sqrt(c); b=log(c); finish; run mymod(s,l,x);Execution of the module statements creates matrices and , containing the square roots and logs, respectively, of the elements of .
call delete(mydata);
The following statements activate the graphics system (CALL GSTART), open a new graphics segment (CALL GOPEN), produce a scatter plot of points (CALL GPOINT), and display the graph (CALL GSHOW):
call gstart; call gopen; call gpoint(x,y); call gshow;
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.