DATA Step, Macro, Functions and more

Change variable formats

Accepted Solution Solved
Reply
Contributor
Posts: 53
Accepted Solution

Change variable formats

I have a macro variable that is in date9. format

&max_date = 21may2014

I would like to change this format to mmddyy10. so it looks better in the title on the results page.

Any suggestions on this?

I have googled it but been unsuccessful in finding an answer.

Thanks


Accepted Solutions
Solution
‎06-11-2014 10:40 AM
Super User
Posts: 19,780

Re: Change variable formats

Probably not the best way, but you can use the putc function.

%let max_date=21May2014;

%put &max_date.;

%let max_date=%sysfunc(putn("&max_date"d, mmddyy10.));

%put &max_date.;

View solution in original post


All Replies
Solution
‎06-11-2014 10:40 AM
Super User
Posts: 19,780

Re: Change variable formats

Probably not the best way, but you can use the putc function.

%let max_date=21May2014;

%put &max_date.;

%let max_date=%sysfunc(putn("&max_date"d, mmddyy10.));

%put &max_date.;

Contributor
Posts: 53

Re: Change variable formats

Works like a charm, thank you very much for the quick reply

🔒 This topic is solved and locked.

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

Discussion stats
  • 2 replies
  • 173 views
  • 0 likes
  • 2 in conversation