Hey SAS Community,
i want to extract just the year of the privious month from the current date in SAS Enterprise Guide. But i can't figure out how to...
Thanks for your help!
Lars
In a data step
prev_year=year(intnx('month',today(),-1));
View solution in original post
Thanks for your quick help!
I've tried something like that before but some how my code didn't work...but yours does!
@kazimir900 hi and welcome to the SAS Community!
You can do something like this
data _null_; yearofprevmonth=year(intnx('month', today(), -1, 'b')); put yearofprevmonth=; run;
%let current_date=%sysfunc(today()); %let prev_month=%sysfunc(intnx(mon,¤t_date,-1),monyy7.); %put &=prev_month;
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.
Register now!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.