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

Re: st: manipulating data


From   Matt Dobra <[email protected]>
To   [email protected]
Subject   Re: st: manipulating data
Date   Mon, 01 Dec 2003 13:00:40 -0500

Michael,

See the help on subscripting, that should help you a lot. A quick solution, though, would be:

gen var2=100*(1+var1) in 1
replace var2=var2[_n-1]*(1+var1) in 2/l

Matt

Michael Carney wrote:


I have a column of daily percentage returns on a security, I would like to make a column of cumulative prices. For example, I plan to fix a beginning value of 100 to the security. If the return for obs 1 were 5% and obs2 10% I would like the new column to have, as its obs 1, $105 and obs 2: 105*(1+.10) and so on. Any help would be greatly appreciated.

--Mike Carney
*
* 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/


*
*   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