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.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: