SYMPUT is a routine that is called inside the data step to produce a symbolic variable, ie assigns a value produced in a DATA step to a macro variable. The variable can not be referenced inside the creating data step. The data step must end with a RUN; statement before you reference the variable in your code.
The syntax is:
DATA dataset(can be NULL);
CALL SYMPUT(name, value);
RUN;
Why do we need the symbolic variable? The answer is simple and this is to get the value of the current record substituted in the variable.
Consider querying DB2 table with inputs from physical file. Symbolic parameter will help/will be needed in the query for processing.
To start with, will see how to set dates using SYMPUT. The output will be displayed in SASLOG in spool. Anyway the variables, (&DATE1/2/3) can be used in the code diligently as and when needed. Even it can be used to override the current date in SAS in header and FOOTER


Leave a comment