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

RE: st: RE: generating percentage data set


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: RE: generating percentage data set
Date   Tue, 30 Jul 2002 18:51:57 +0100

Michael Carney
> 
> I think I would likely consider it a formula: i'd like to 
> generate a new
> variable in which each observation of the variable price, 
> for example, is
> subrtacted from its previous observation. E.g., if obs1 in 
> "price" is 100 and
> obs2 is 75 i would like the first observation in "change in 
> price" to be -25,
> and so forth.
> 

I don't understand how this relates to the previous 
formulation, but this sounds like, given variables 
-time- and -price-, 

tsset time 
gen chprice = D.price 
gen pcchprice = 100 * D.price / L.price  

See help on -tsset- and -varlist-.

Nick 
n.j.cox@durham.ac.uk 

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index