What does your data look like? What have you tried already?
I managed to calculate the average but failed to do the standard deviation of the new variable (SalesVol) over the previous seven years (requiring at least three non-missing observations). I am attaching a sample of my data.
proc sort data=data1; by ID year; run;
proc sort data=data1; by id year;
data data1 (compress=yes); set data1; by ID year;
n+1;
if first.id then n=1;
lag_TA = lag(TA);
if n = 1 then do; lag_TA =.; end;
AvgTA = (TA+ lag_TA)/2;
SalesVol = sales/ AvgTA;
Run;
Hi,
I still have not received an answer to my question. Can anyone help, please?
Start by providing usable example data in a data step with datalines, so we can recreate your data with a simple copy/paste and submit. Excel spreadsheets tell us nothing about column attributes, and are not downloadable in corporate environments where security measures block them.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.