title: SAS: Calculate rolling standard deviation
body: <p>Relatively new to SAS here and I am having trouble calculating rolling standard deviation for equity stock returns.</p>
  
  <p>I have a table named "stocks_ret" which contains 3 columns: date, stock number, returns. The data is monthly.</p>
  
  <p>I want to calculate the standard deviation of returns for the past 36 months for each stock.</p>
  
  <p>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)</p>
  
  <p>Please help! Thanks!</p>