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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.