Problem with sas-dates

sonmic used Ask the Experts™

I have a part of a macro :
%IF &DateCopy eq &DateOrg And &DateCopy ne &sysdate %THEN %DO ;
which compares the modification dates of 2 files. This is not enough, so I must also compare one of the dates with the current date.
%PUT &DateCopy &DateOrg &sysdate ;
18555    18555 20OCT10
I believe that the problem is the &sysdate.
How can i solve this?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

1.  SYSDATE is the date that the SAS session or job starts running.  Thus if the job runs over midnight, or over a couple of days, SYSDATE will not contain the current date.  This may or may not be an issue.

If it is an issue - rather use %SYSFUNC(TODAY()), which will give the current date from the system date at the time of execution.

2.  SYSDATE is formatted as a DATE7..  Thus to convert to a number - you can use:

%SYSFUNC(INPUTN(&sysdate, date7.))


%SYSFUNC(INPUTN(&sysdate9, date9.));

Hope this help?


actually you could quite simply just change &sysdate to "&sysdate"d <-- note the additional double quotation marks and a 'd' at the end.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial