08-21-2017 12:14 PM
I have a time series that I have run X11 on and have the resulting seasonal factors. I would like to create an average seaonal factor series for each seassonal factor. This means that each month will be the average of all other seasonal factors for that month.
For example, if the seasonal factors for January for a time series variable are:
Then the new average seasonal factor series will be the average of all January seasonal factors (5+10+15+20)/4=12.5. The same would be done for all 12 months. The output for this example would be
and so on. February would be the average of all other Februarys.
I tried proc means with class as my date, but this did not work.
08-21-2017 12:58 PM
Do you want a data step?
Have 2 _temporary_ arrays, one(K) to hold the sum of VALs and another to hold the count of values added to each of 12 cells.
In the first pass of input data set, build the 2 arrays. In the second pass replace the values by the average computed using K[i] / C[i] where i = 1 to 12. If i-th cell is missing do not write out.
08-21-2017 03:13 PM
Try your means code with
Format <name of the data variable> monname3.;
You should get your cross year means and the date will look like Jan, Feb, Mar, ... , Dec.
You would have to do something else to merge back onto multiple records but you haven't shown quite enough information abou tyour data, variable names/types and such.