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" <[email protected]>
To   <[email protected]>
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-.

[email protected] 

*   For searches and help try:

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