Relatively new to SAS here and I am having trouble calculating rolling standard deviation for equity stock returns.
I have a table named "stocks_ret" which contains 3 columns: date, stock number, returns. The data is monthly.
I want to calculate the standard deviation of returns for the past 36 months for each stock.
The final table should contain 4 columns: date, stock number, returns, rolling standard deviation. Observations without a standard deviation value should be removed (i.e. observations less than 36 months old will not appear in the final table)
Please help! Thanks!