BookmarkSubscribeRSS Feed
Almutairi
Fluorite | Level 6
Spoiler
Hi,

Kindly, I would like to create a code that measures sales volatility (SalesVol) which is computed as the standard deviation of annual sales (sales) divided by the average total assets (AvgTA) over the prior seven years (requiring at least three non-missing observations). 

Your assistance is highly appreciated.
4 REPLIES 4
PeterClemmensen
Tourmaline | Level 20

What does your data look like? What have you tried already?

Almutairi
Fluorite | Level 6

 

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;

Almutairi
Fluorite | Level 6

Hi,

I still have not received an answer to my question. Can anyone help, please?

 

 

Kurt_Bremser
Super User

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.

Ready to join fellow brilliant minds for the SAS Hackathon?

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!
What is ANOVA?

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.

Discussion stats
  • 4 replies
  • 576 views
  • 0 likes
  • 3 in conversation