BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ivanpersie
Fluorite | Level 6

Hi there,

I am trying to compute the standard deviation of the trailing 12 months stock returns. What program code can i use? Thanks in advance for your help

1 ACCEPTED SOLUTION
6 REPLIES 6
data_null__
Jade | Level 19

Do you have SAS/ETS software?

ivanpersie
Fluorite | Level 6

Yes i have SAS  software

PGStats
Opal | Level 21

SAS/ETS is a collection of tools for econometrics and time-series data processing and analysis. It includes PROC EXPAND, a procedure for transforming time series data in many ways, including your requirement for the standard deviation of a moving time window. - PG

PG
Astounding
PROC Star

If you only have SAS, but not SAS/ETS, there are still ways to do this.

This forum has addressed how to calculate a moving sum (for the last 12 observations, for example).

You would also have to calculate the moving sum of the squared values, using similar techniques.

If you know SUM, SUM of the squared values, and N=12, you can calculate the standard deviation.

But it's easier of you have SAS/ETS.

ivanpersie
Fluorite | Level 6

Please send me that link for calculating a moving sum

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 888 views
  • 0 likes
  • 5 in conversation