SYSPARM Automatic Macro Variable

Contains a character string that can be passed from the operating environment to SAS program steps.
Type: Automatic macro variable (read and write)

Details

SYSPARM enables you to pass a character string from the operating environment to SAS program steps and provides a means of accessing or using the string while a program is executing. For example, you can use SYSPARM from the operating environment to pass a title statement or a value for a program to process. You can also set the value of SYSPARM within a SAS program. SYSPARM can be used anywhere in a SAS program. The default value of SYSPARM is null (zero characters).
SYSPARM is most useful when specified at invocation of SAS. For details, see the SAS documentation for your operating environment.
Note: The macro processor always stores the value of SYSPARM in unquoted form. To quote the resolved value of SYSPARM, use the %SUPERQ macro quoting function.

Comparisons

  • Assigning a value to SYSPARM is the same as specifying a value for the SYSPARM= system option.
  • Retrieving the value of SYSPARM is the same as using the SYSPARM() SAS function.

Example: Passing a Value to a Procedure

In this example, you invoke SAS on a UNIX operating environment on September 20, 2011 (the librefs DEPT and TEST are defined in the config.sas file) with a command like the following:
sas program-name -sysparm dept.projects -config /myid/config.sas
Macro variable SYSPARM supplies the name of the data set for PROC REPORT:
proc report data=&sysparm
     report=test.resorces.priority.rept;
title "%sysfunc(date(),worddate.)";
title2;
title3 'Active Projects By Priority';
run;
SAS sees the following:
proc report data=dept.projects
     report=test.resorces.priority.rept;
title "September 20, 2011";
title2;
title3 'Active Projects By Priority';
run;