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.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.