Hi,
Can you please help me with this ask ?
So I have
%let start_month = 1801
%let end_month = 1907
I want to create a datatable containing only one column which will have all the months from start to end. I am assuming I should append a new month values in a do loop.
Thanks,
Hi and welcome to the SAS Community 🙂
Does 1801 represent january in 2018?
Thank you 🙂
yes 1801 is January 2018,
@akosyan wrote:
Hi,
Can you please help me with this ask ?
So I have
%let start_month = 1801
%let end_month = 1907
I want to create a datatable containing only one column which will have all the months from start to end. I am assuming I should append a new month values in a do loop.
Thanks,
Don't bother with macros.
data want;
startmonth='01JAN18'd;
endmonth='01JUL19'd;
month=startmonth;
do while(month le endmonth);
output;
month=intnx('month',month,1);
end;
keep month;
format month yymm5.;
run;
Thanks Paige,
It worked, except for the formatting I needed to put yymmn4.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.