data _NULL_;
CALL SYMPUTx('mth1',put(intnx('year',today(),-1,'b'),monyy5.),'g') ;
CALL SYMPUTx('mth12',put(intnx('year',today(),-1,'e'),monyy5.),'g') ;
run;
Output is JAN19 and Dec19 respectively
I am attempting to get remaining months exactly 1 full year ago starting with Jan19
How would I be able to use the same logic for say FEB19, MAR19...etc.
You need a different call to INTNX(). For example, 11 months earlier would use:
intnx('month',today(),-11)
@Q1983 wrote:
data _NULL_;
CALL SYMPUTx('mth1',put(intnx('year',today(),-1,'b'),monyy5.),'g') ;
CALL SYMPUTx('mth12',put(intnx('year',today(),-1,'e'),monyy5.),'g') ;
run;
Output is JAN19 and Dec19 respectively
I am attempting to get remaining months exactly 1 full year ago starting with Jan19
How would I be able to use the same logic for say FEB19, MAR19...etc.
I have to say I do not understand what you mean by "remaining months". or what the actual desired output for a given input is here.
Normally "remaining months" to me would be a number of months left after removing or some interval. So for "exactly 1 full year" that would tend to be 12 months?!?
If you expect to create date incrementing months then I would expect to see an interval unit of 'month'.
Hi,
try this:
data _NULL_;
do i = 0 to 11;
CALL SYMPUTx(cats('mth',i+1),put(intnx('month',today(),-12+i,'b'),monyy5.),'g');
end;
run;
%put _user_;
All the best
Bart
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.