Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Variable Manipulation


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Variable Manipulation
Date   Sat, 1 Mar 2008 16:58:09 +0000 (GMT)

bys company (year) : gen droa = roa - roa[_n-1]
bys company (year) : gen rretind = retind / retind[_n-1]

if you have missings than this will become twice as bad for these new
variables: say you have missing in roa in 2000 than droa will be
missing in 2000 and 2001. So you might want to consider imputing your
data first before you do this, using for instance -ice-, see: -findit
ice-.

Hope this helps,
Maarten

--- Katarina Sikavica <k-sikavica@kellogg.northwestern.edu> wrote:

> Dear Statalisters:
> 
> I am working with a panel dataset containing company performance data
> and would like to calculate 
> a) the annual change in return on assets (varname: ROA) which is
> calculated as e.g. ROA in the year 2000 - ROA in 2001
> b) the ratio of return index (varname: RETIND), calculated as e.g.
> RETIND in 2000 / RETIND in 1999
> 
> The dataset is a unbalanced panel of company performance data
> 1998-2005
> and contains, unfortunately, quite some missings in the performance
> variables (!). The missings are coded using "." The data can be
> grouped
> according to company name, year (varname: YEAR) and a unique numeric
> identfier(varname: DSCODE) retrieved frot Thomson Anaytics.
> 
> I have spent some time trying to generate the above mentioned
> variables
> (I have tried playing around with _n and _N) but was, unfortunately
> unable to obtain the correct variable. I have searched STATA FAQ and
> have used the findit command but given that I don't even know what
> the
> right keyword is I did not find any useful information. 
> I appologize if this procedure has allready been explained
> elsewhere...
> 
> Many thanks for your help,
> Best,
> Kate 
> 
> 
> *
> *   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/
> 


-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      ___________________________________________________________ 
Rise to the challenge for Sport Relief with Yahoo! For Good  

http://uk.promotions.yahoo.com/forgood/
*
*   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