SYSDSN Automatic Macro Variable

Contains the libref and name of the most recently created SAS data set.
Type: Automatic macro variable (read and write)
See: SYSLAST Automatic Macro Variable

Details

The libref and data set name are displayed in two left-aligned fields. If no SAS data set has been created in the current program, SYSDSN returns eight blanks followed by _NULL_ followed by two more blanks.
Note: The macro processor always stores the value of SYSDSN in unquoted form. To quote the resolved value of SYSDSN, use the %SUPERQ macro quoting function.

Comparisons

  • Assigning a value to SYSDSN is the same as specifying a value for the _LAST_= system option.
  • The value of SYSLAST is often more useful than SYSDSN because the value of SYSLAST is formatted so that you can insert a reference to it directly into SAS code in place of a data set name.

Example: Comparing Values Produced by SYSDSN and SYSLAST

Create a data set WORK.TEST and then enter the following statements:
%put Sysdsn produces:  *&sysdsn*;
%put Syslast produces: *&syslast*;
When these statements execute, the following lines are written to the SAS log:
Sysdsn produces:  *WORK    TEST    *
Syslast produces: *WORK.TEST    *
When the libref or data set name contain fewer than eight characters, SYSDSN maintains the blanks for the unused characters. SYSDSN does not display a period between the libref and data set name fields.