I have a monthly time series and want to make quarterly observations. I started by assigning observations to quarters and thought to somehow use proc means to generate the average value of each trio of year-quarter values. How do I use proc means to create mean values where of all like year and quarter values?
year month quarter value
1992 1 2 x
1992 2 2 y
1992 3 2 z
1992 4 3 a
1992 5 3 b
1992 6 3 c
Goal: use proc means to calc:
(x + y z) / 3 , (a + b + c) / 3
Thank you for the soln. I navigated my way to a less elegant soln. I concatenated year and quarter and used:
proc means data=i;
output out=Meanvalue Mean=value;
For the sake of learning, why did you specify nway? Can class work on combinations of variables like Year Quarter - don't they need to be concatenated? I am guessing you used nway b.c. you have two classes, yes?
Look at nway description in SAS help it explains the use of nway in detail.
"I am guessing you used nway b.c. you have two classes, yes?" it does not matter how many classes do you have. For example, in your code you have only one class but Meanvalue contains means for total dataset (not divided in classes for _type_=0 ) and for each value of the class (_type_=1). If you add nway option then only means for different values of class variable are calculated. If you have several classes then with nway option proc means calculates means for all combinations of class values.