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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.