Passing Parameters to R

The SUBMIT statement supports parameter substitution from SAS/IML matrices as detailed in the section Passing Parameters from SAS/IML Matrices. For example, you can substitute the names of analysis variables into a SUBMIT block by using the following statements:

YVar = "Weight";
XVar = "Height";
submit XVar YVar / R;
   Model <- lm(&YVar ~ &XVar, data=Class, na.action="na.exclude")
   print (Model$call)
endsubmit;

Figure 11.4 shows the result of the print(Model$call) statement. The output shows that the values of the YVar and XVar matrices were substituted into the SUBMIT block.

Figure 11.4: Parameter Substitutions in a SUBMIT Block

lm(formula = Weight ~ Height, data = Class, na.action = "na.exclude")