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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.