Improving Program Efficiency with Macro Variables |
Using Automatic Macro
Variables |
Using other automatic macro variables is just as easy as using the SYSDATE
macro variable. For example, if you need the day of the week and the full
date when a SAS session began, you can reference the SYSDAY
and SYSDATE9 automatic macro variables. Simply specify the
macro variable name, preceded by an ampersand.
title 'Temporary Employees Hired in November'; footnote "Report Run on &sysday, &sysdate9"; data hrd.tempnov; set hrd.temp; if month(begindate)=11; run; proc print data=hrd.tempnov; run; The output is displayed with the following footnote. |
Report Run on Friday, 12MAY2000 |
Here is a list of some commonly used automatic macro variables and the information they supply. |
Name | Information Supplied | Example |
---|---|---|
SYSDATE9 | date the job or session began executing | 21APR2000 |
SYSDATE | date the job or session began executing | 16FEB98 |
SYSDAY | weekday the job or session began executing | Tuesday |
SYSTIME | time the job or session began executing | 15:32 |
SYSSCP | operating system abbreviation | CMS |
SYSVER | SAS software version and/or release number | 7.0 |
SYSLAST | name of the most recently created data set | HRD.TEMP99 |
Reserved Names for Macro Variables
Notice that all automatic macro variables begin with the letters SYS. SAS software reserves the right to use the SYS prefix for automatic macro variables. It is recommended that you not begin the name of any user-defined macro variable with the letters SYS. For a complete list of automatic macro variables, refer to SAS Macro Language: Reference. |
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.