Chapter Contents |
Previous |
Next |
SYSDATE9 |
Restriction: | Automatic macro variable (read only) |
See also: | SYSDATE |
Details | |
Example | |
Formatting a SYSDATE9 Value |
Details |
SYSDATE9 contains a SAS date value in the DATE9. format, which displays a two-digit date, the first three letters of the month name, and a four-digit year. The date does not change during the individual job or session. As an example, you could use SYSDATE9 in programs to check the date before you execute code that you want to run on certain dates of the month.
Example |
Macro FDATE assigns a format you specify to the value of SYSDATE9:
%macro fdate(fmt); %global fdate; data _null_; call symput("fdate",left(put("&sysdate9"d,&fmt))); run; %mend fdate; %fdate(worddate.) title "Tests for &fdate";
If you execute this macro on July 28, 1998, SAS sees the statements:
DATA _NULL_; CALL SYMPUT("FDATE",LEFT(PUT("28JUL1998"D,WORDDATE.))); RUN; TITLE "Tests for July 28, 1998";
For another method of formatting the current date, see the %SYSFUNC and %QSYSFUNC functions.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.