Pane
Pane

Reputation: 555

Macro variable to SAS date

quick question here.

How could I adapt this code so that it would work with %let DTD=2012-12-31;

%let DTD=31-DEC-2013;

DATA _Null_;
dd="&DTD"d;
put dd;
RUN;

Then dd has a value of 19723. Thanks in advance !

Upvotes: 2

Views: 217

Answers (1)

Joe
Joe

Reputation: 63434

You would have to use INPUT instead of "&var"d;

dd = input("&DTD",yymmdd10.);

Now, hopefully you wouldn't use 2012-12-32, since that's not a real date. :)

Upvotes: 3

Related Questions