Tailoring your programs using parameters from JCL
The SYSPARM macro
Tailoring your programs by accepting parameters from JCL enables that program to provide multiple functions. This technique enables operations to control jobs by modifying JCL. Assigning a character string to the SYSPARM option of the SAS execution statement assigns that string to the SAS system macro variable SYSPARM. The following shows the JCL to include the text into the SYSPARM macro variable. The value of the SYSPARM macro variable is included into the SAS log during initialization. I also include SAS code that uses the SYSPARM macro variable.
//A EXEC SAS,OPTIONS='SYSPARM="field1,field2,field3"' //SYSIN DD * Data SYSPARM ; SYSPARM =&SYSPARM ; PROC PRINT ;
I designed a macro to enable passing multiple parameters. The SYSPARM macro to separate the SYSPARM character string into multiple strings delimited by the comma is helpful. The following shows the JCL and the SAS control statements to execute the SYSPARM macro. I also used and printed the value of the field1, field2, and field3.
//A EXEC SAS,OPTIONS='SYSPARM="field1,field2,field3"' //SYSIN DD * /* Include SYPARM macro */ %SYSPARM; Data SYSPARM ; PARM1=&PARM1 ; PARM2=&PARM2 ; PARM3=&PARM3 ; PROC PRINT ;
The SYSPARM macro list in SASLOG each SAS macro variable created by the SYSPARM macro.
%MACRO SYSPARM(INIT=ZZ,NUM=20,CHAR=%QUOTE(,)) ;