Automatic Macro Variables |
Contains the date that a SAS job or session began executing.
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.
Macro FDATE
assigns a format you specify to the value of SYSDATE9:
%macro fdate(fmt);
b %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, 2008, SAS sees the statements:
DATA _NULL_;
CALL SYMPUT("FDATE",LEFT(PUT("28JUL2008"D,WORDDATE.)));
RUN;
TITLE "Tests for July 28, 2008";
For another method of formatting the current date, see the %SYSFUNC
and %QSYSFUNC functions.
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.