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.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.