DATA Step, Macro, Functions and more

converting sasdate macro variable to date9.?

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 8
Accepted Solution

converting sasdate macro variable to date9.?

Hi,

 

I have a macro variable _mydate in the sasdate format, is there anyway to convert it to data9. foramt?

 

For example,

 

%let _mydate = 20399;

 

I want it to be 

 

&_mydate =07NOV2015

 

 

Thanks!

 

 

 

 

 


Accepted Solutions
Solution
‎09-14-2017 11:16 PM
Super User
Posts: 22,823

Re: converting sasdate macro variable to date9.?

How are you creating the date, is there an option to create it formatted in the first place?

 

%let date = %sysfunc(today(), date9.);
%put &date.;

View solution in original post


All Replies
Super User
Posts: 3,765

Re: converting sasdate macro variable to date9.?

%let _mydate = %sysfunc(putn(20399, date9.));

%put &_mydate;
Solution
‎09-14-2017 11:16 PM
Super User
Posts: 22,823

Re: converting sasdate macro variable to date9.?

How are you creating the date, is there an option to create it formatted in the first place?

 

%let date = %sysfunc(today(), date9.);
%put &date.;
Occasional Contributor
Posts: 8

Re: converting sasdate macro variable to date9.?

It's the most recent date from a datset.
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 182 views
  • 0 likes
  • 3 in conversation