|
Chapter Contents |
Previous |
Next |
| Understanding the 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
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);returns two matrices (vectors), VAL and VEC, containing the eigenvalues and eigenvectors, respectively, of the symmetric matrix T.
You can program your own subroutine using the START and FINISH statements to define a module. You can then execute the module with a CALL statement or a 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 create matrices
S and L, containing the square roots
and logs, respectively, of the elements of X.
call delete(mydata);deletes the SAS data set named MYDATA.
The statements
call gstart; call gopen; call gpoint(x,y); call gshow;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).
|
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.