BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Elliott
Obsidian | Level 7

am trying to create a macro variable to append to a report name and I need it to be mmdd, (ie 0709, for july 9th).  So far I have been unsuccessful trying to separate the date parts and concatenating back together in this format.  I know there is probably an easy fix but I am just not getting there.  Any assistance will be greatly appreciated.

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

Use mmddyyN4 format like this

 

data _null_;
work_date= today();
call symput ("wod",put(work_date,mmddyyN4.));
run;

%put &wod.;

View solution in original post

6 REPLIES 6
PeterClemmensen
Tourmaline | Level 20

How are your date values stored?

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Show some test data, we can't guess!

data _null_;
  call symput('d',put('01JAN2016'd,yymmdd10.));
run;

ods rtf file="abc_&d..rtf";
...

For example.

Elliott
Obsidian | Level 7

sorry,

 

I am using the today function for the date.

 

data _null_;

work_date= today();

call symput ("wod",put(work_date,yymmddn8.));

run;

PeterClemmensen
Tourmaline | Level 20

Use mmddyyN4 format like this

 

data _null_;
work_date= today();
call symput ("wod",put(work_date,mmddyyN4.));
run;

%put &wod.;
Elliott
Obsidian | Level 7
Thank you so much, you all are awesome!
rvsidhu035
Quartz | Level 8

 

data month_date;
x='07jun1989'd;
format x mmddyyn4.;
run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 1495 views
  • 3 likes
  • 4 in conversation