Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Trailing 60-day standard deviation


From   "Susan Lewis" <[email protected]>
To   <[email protected]>
Subject   st: Trailing 60-day standard deviation
Date   Tue, 16 Jul 2002 13:18:55 -0400

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index