Hello everyone,

I was wondering whether anyone can help me with the following. I'm trying to retrieve the standard deviation of the variable "Price" over the last 10 periods. It should be calculated on a rolling basis (10-period). I came up with the following command, but I am wondering whether it is correct:
Code:
 rangestat (count) n=Price (sd) sd = Price, interval (N -9 0)

Dataex code:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(Price N)
52.22  1
52.78  2
53.02  3
53.67  4
53.67  5
53.74  6
53.45  7
53.72  8
53.39  9
52.51 10
52.32 11
51.45 12
 51.6 13
52.43 14
52.47 15
52.91 16
52.07 17
53.12 18
52.77 19
52.73 20
52.09 21
53.19 22
53.73 23
53.87 24
53.85 25
53.88 26
54.08 27
54.14 28
 54.5 29
 54.3 30
 54.4 31
54.16 32
end
Thank you in advance!