Help using Base SAS procedures

Reg Date

Reply
Regular Contributor
Posts: 229

Reg Date

Hi i am having a date i should minus it from the todays date(sysdate)

Data a;
input date ddmmyy10.;
cards;
05/02/2011
run;

for examples sysdate is 10/02/2011 then out put sholud be date=5 it should be automatic as the systemdate but not with today function
Super Contributor
Posts: 260

Re: Reg Date

Hi.
Since SAS dates are stored as number of days (beginning on day 0 which is january 1st, 1960), what you want to do is basically a substraction.
The SAS function called TODAY() or DATE() -- both give the same result -- will deliver the exact date every day.
[pre]Data a;
input date ddmmyy10.;
gap = TODAY() - date ;
cards;
05/02/2011
run;[/pre]
Regular Contributor
Posts: 229

Re: Reg Date

Thanks for your reply but i want it my macro sysdate.
Super Contributor
Super Contributor
Posts: 3,174

Re: Reg Date

Yes, you can code/use the SAS-maintained macro variable &SYSDATE using a date-constant technique:

DATA _NULL_;
TODAY = "&SYSDATE"D;
PUT TODAY= DATE9.;
RUN;

Do consider that the SAS function TODAY() and using &SYSDATE as shown above are equivalent.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search argument, this topic / post:

data step sysdate constant site:sas.com
Ask a Question
Discussion stats
  • 3 replies
  • 144 views
  • 0 likes
  • 3 in conversation