A SUBMIT statement that contains an explicit list of parameters is easier to understand than a SUBMIT statement that contains only the asterisk wildcard charater (*). Specifying an explicit list of parameters is called specific substitution. These—and only these—parameters are used to make substitutions into the SUBMIT block.
proc iml; DSName = "Sashelp.Class"; NumObs = 2; submit DSName NumObs; proc print data=&DSName(obs=&NumObs); run; endsubmit;
Figure 10.5: Specific Substitution
Obs | Name | Sex | Age | Height | Weight |
---|---|---|---|---|---|
1 | Alfred | M | 14 | 69.0 | 112.5 |
2 | Alice | F | 13 | 56.5 | 84.0 |
If the SUBMIT block contains a parameter reference (that is, a token that begins with an ampersand (&) for which there is no matching parameter, the parameter reference is not modified prior to being sent to the SAS language processor. In this way, you can reference SAS macro variables in a SUBMIT block.
With specific substitution, you have additional options for specifying the value of a parameter. You can use any of the following ways to specify the value of a parameter:
Specify the name of a SAS/IML matrix to use for the value of a parameter, as shown in the following statements:
s = "Sashelp.Class"; n = 2; submit DSName=s NumObs=n; proc print data=&DSName(obs=&NumObs); run; endsubmit;
Specify a literal value to use for the value of a parameter, as shown in the following statements:
submit DSName="Sashelp.Class" NumObs=2; proc print data=&DSName(obs=&NumObs); run; endsubmit;
Specify a matrix expression that is enclosed in parentheses, as shown in the following statements:
libref = "Sashelp"; fname = "Class"; NumObs = 2; submit DSName=(libref+"."+fname) NumObs; proc print data=&DSName(obs=&NumObs); run; endsubmit;