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.
Use mmddyyN4 format like this
data _null_;
work_date= today();
call symput ("wod",put(work_date,mmddyyN4.));
run;
%put &wod.;
How are your date values stored?
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.
sorry,
I am using the today function for the date.
data _null_;
work_date= today();
call symput ("wod",put(work_date,yymmddn8.));
run;
Use mmddyyN4 format like this
data _null_;
work_date= today();
call symput ("wod",put(work_date,mmddyyN4.));
run;
%put &wod.;
data month_date;
x='07jun1989'd;
format x mmddyyn4.;
run;
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.