Hello,
I have 90 lines of data. I want to calculate the mean and some other metrics for the first 35 years of data, then for years 2-36, then 3-37, etc and then view all of these mean series. How do I do this? Thanks very much for your help.
Can you show us your data?
One method is using a multilabel format
Example:
proc format;
value yearf (multilabel)
1-35='1-35'
2-36='2-36'
3-37='3-37'
/* I'm lazy, you type the rest */
;
run;
proc summary data=have nway;
class year_since_start/mlf format=yearf.;
var some_other_variables;
output out=_stats_ mean= std= min= max=/autoname;
run;
Another method, if you have SAS/ETS and PROC EXPAND, is to calculate moving averages of length 35 based upon your year variable. Probably less typing.
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!
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.