Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: generate the level series from the growth rate series
From
annoporci <[email protected]>
To
[email protected]
Subject
st: generate the level series from the growth rate series
Date
Fri, 04 Jan 2013 07:50:36 +0800
Dear Statalist,
This must be a very simple question...
I have data for percentage changes and would like to reconstruct the
levels of the variables.
Taking the sp500 dataset, I show below that I can generate the one-period
difference series for the level variable "close", with and without tsset.
Then I try to reverse-engineer to recover the level variable "close" from
the difference series named "change", but I get stuck.
sysuse sp500
gen change2 = close-close[_n-1] /// method without tsset
gen t=_n
tsset t
gen change3 = close-L.close /// method with tsset
gen close2 = .
replace close2 = 1283.27 in 1 /// assign the first value
replace close2 = close2[_n-1]+change /// try to recover the level
This last step fails.
I'd appreciate your help very much.
--
Patrick Toche.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/