The SUBMIT statement enables you to substitute the values of a SAS/IML matrix into the statements that are submitted to the
SAS System. For example, the following program calls the UNIVARIATE procedure to analyze data in the MyData
data set that was created in the section Calling a Procedure. The program submits SAS statements that are identical to the SUBMIT block in that section:
table = "Moments"; varName = "q"; submit table varName; ods select &table; proc univariate data=MyData; var &varName; ods output &table=&table; run; endsubmit;
You can list the names of SAS/IML matrices in the SUBMIT statement and refer to the contents of those matrices inside the SUBMIT block. The syntax is reminiscent of the syntax for macro variables: an ampersand (&) preceding an expression means "substitute the value of the expression." However, the substitution takes place before the SUBMIT block is sent to the SAS System; no macro variables are actually created.
You can substitute values from character or numeric matrices and vectors. If x
is a vector, then &x
lists the elements of x
separated by spaces. For example, the following statements compute trimmed means for three separate values of the TRIM= option:
table = "TrimmedMeans"; varName = "q"; n = {1, 3, 5}; /* number of observations to trim */ submit table varName n; ods select &table; proc univariate data=MyData trim=&n; var &varName; run; endsubmit;
The output is shown in Figure 10.3. The values in the column labeled "Number Trimmed in Tail" correspond to the values in the n
matrix. These values were substituted into the TRIM= option in the PROC UNIVARIATE statement.
Figure 10.3: Statistics Read into SAS/IML Vectors
Trimmed Means | ||||||||
---|---|---|---|---|---|---|---|---|
Percent Trimmed in Tail |
Number Trimmed in Tail |
Trimmed Mean |
Std Error Trimmed Mean |
95% Confidence Limits | DF | t for H0: Mu0=0.00 |
Pr > |t| | |
7.14 | 1 | 5.741667 | 0.664486 | 4.279142 | 7.204191 | 11 | 8.64076 | <.0001 |
21.43 | 3 | 5.575000 | 0.587204 | 4.186483 | 6.963517 | 7 | 9.49414 | <.0001 |
35.71 | 5 | 5.625000 | 0.408613 | 4.324612 | 6.925388 | 3 | 13.76609 | 0.0008 |