Solved
Contributor
Posts: 69

# Standard Deviation over last 8 periods

Hi,

I have a monthly price variable and want to calculate its standard deviation over last 8 month. I will be thankful if anyone can help.

I have lot of firms and i want to calcualte these standard deviation in each firm.

every firm has many years of Monthly data and resulting varibale will be for each month on the basis of lag 8 month (last 8 month)
Thanks

Accepted Solutions
Solution
‎06-05-2017 07:00 PM
Super User
Posts: 20,731

## Re: Standard Deviation over last 8 periods

Concept is here:

http://support.sas.com/kb/22/104.html

Change the idea from average to standard deviation is changing the function used (mean to std), otherwise everything else is the same. Note one of hte later examples shows how to do this with BY groups, ie by Firm.

All Replies
Solution
‎06-05-2017 07:00 PM
Super User
Posts: 20,731

## Re: Standard Deviation over last 8 periods

Concept is here:

http://support.sas.com/kb/22/104.html

Change the idea from average to standard deviation is changing the function used (mean to std), otherwise everything else is the same. Note one of hte later examples shows how to do this with BY groups, ie by Firm.

Contributor
Posts: 69

## Re: Standard Deviation over last 8 periods

Thank you very much. Proc Expand is really amazing procedure.
Good day
PROC Star
Posts: 7,649

## Re: Standard Deviation over last 8 periods

It would help if you can provide examples of the data you have, and the dataset you want, for at least one firm.

Art, CEO, AnalystFinder.com

Contributor
Posts: 69

## Re: Standard Deviation over last 8 periods

Thank you very much for your cooperation. Someone else suggested helpful article which solved my issue perfectly.
Good day
☑ This topic is solved.