Chapter Contents

Previous

Next
SYSDATE

SYSDATE



Contains the date that a SAS job or session began executing

Restriction: Automatic macro variable (read only)
See also: SYSDATE9


Details
Example
Formatting a SYSDATE Value


Details

SYSDATE contains a SAS date value in the DATE7. format, which displays a two-digit date, the first three letters of the month name, and a two-digit year. The date does not change during the individual job or session. As an example, you could use SYSDATE 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 SYSDATE Value

Macro FDATE assigns a format you specify to the value of SYSDATE:

%macro fdate(fmt);
   %global fdate;
   data _null_;
      call symput("fdate",left(put("&sysdate"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("28JUL98"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.