- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What does your data look like? What have you tried already?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I still have not received an answer to my question. Can anyone help, please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.