Previous Page | Next Page

Automatic Macro Variables

SYSDATE9 Automatic Macro Variable



Contains the date that a SAS job or session began executing.
Type: Automatic macro variable (read only)
See also: SYSDATE Automatic Macro Variable

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


Example 1: Formatting a SYSDATE9 Value

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.

Previous Page | Next Page | Top of Page