Hi,
I am new to SAS and I need to know how to limit the number of months to 24.
Every month I upload new data and would like the oldest month to be dropped off.
Any advice?
Are you talking about data sets, variables, or observations? Show some example data.
Months are variables in the data
Depends on how the month variables are named. Here is an example that might be helpful.
proc contents varnum; data have;
input id date;
format date mmddyy10.;
informat date mmddyy10.;
cards;
1 01/01/2014
2 01/01/2013
3 01/01/2012
;
run;
data want;
set have;
var1=INTCK('Month',date,today());
if INTCK('Month',date,today()) ge 24 then delete;
else output;
run;
proc print; run;
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.