Seems I must be missing something obvious, but I can't find a compact way to calculate a trailing
60-day standard deviation. Data are in long format as follows:
Entity 1 Day 1 Value
Entity 1 Day 2 Value
Entity 1 Day 3 Value
.
.
.
Entity 1 Day 365 Value
Entity 2 Day 1 Value
Entity 2 Day 2 Value
.
.
.
Entity 100 Day 365 Value
Goal is to end up with:
Entity 1 Day 1 Value (missing)
Entity 1 Day 2 Value (missing)
.
.
.
Entity 1 Day 364 Value SD ENTITY 1 DAYS 304-364
Entity 1 Day 365 Value SD ENTITY 1 DAYS 305-365
.
.
.
Entity 100 Day 365 Value SD ENTITY 100 DAYS 305-365
Any advice would be greatly appreciated.
Susan Lewis
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/