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]
Re: st: generate growths variable out of two other variables
From
Carlos Avellaneda Suárez <[email protected]>
To
[email protected]
Subject
Re: st: generate growths variable out of two other variables
Date
Wed, 26 Mar 2014 17:25:41 -0500
Hi Julian.
Here is a simple solution you can apply:
input str1 firm year x
a 2003 4
a 2004 5
a 2005 7
a 2006 9
a 2007 54
b 2003 45
b 2004 44
b 2005 39
b 2006 54
b 2007 40
end
bys firm (year): gen gr_2007 = x/x[_n-1] - 1 if year==2007
egen touse=sum(gr), by(firm)
drop if touse>=4
drop touse
Hope this helps. Best regards,
Carlos
2014-03-26 17:24 GMT-05:00 Carlos Avellaneda Suárez
<[email protected]>:
> Hi Julian.
> Here is a simple solution you can apply:
>
> input str1 firm year x
> a 2003 4
> a 2004 5
> a 2005 7
> a 2006 9
> a 2007 54
> b 2003 45
> b 2004 44
> b 2005 39
> b 2006 54
> b 2007 40
> end
> bys firm (year): gen gr_2007 = x/x[_n-1] - 1 if year==2007
> egen touse=sum(gr), by(firm)
> drop if touse>=4
> drop touse
>
> Hope this helps. Best regards,
> Carlos
>
>
> 2014-03-26 11:40 GMT-05:00 Julian Kochan <[email protected]>:
>
>> Hi,
>>
>> i have a set of data with financial firm characteristics of about 10.000
>> firms for Year 2000 - Year 2012.
>>
>> Let's assume: The first column of the data table displays the Name of the
>> firm, the second the Year, the third displays the TotalAssets.
>> Thus, 13 rows in a row (2000-2012) display information about just one firm
>> - just the year varies.
>>
>> Problem: I want to to drop those firms for which the Asset growth from
>> 2006 to 2007 is higher than 400 %
>> If this is the case, the firm should be dropped out of
>> my data completely such that the firm observation is not only dropped for
>> 2006 and 2007, but also for all the other years.
>>
>> Thus I want to generate a variable for which asset growth
>> from 2006 to 2007 is higher than 400 %. Here is my problem.
>> generate asset_growth if ("TotalAssets in 2007/ Total
>> Asset in 2006 > 400%.")
>> How do I include the years correctly ?
>>
>> generate asset_growth = ((TotalAssets &
>> Year==2007)/(TotalAssets & Year==2006)) doesn't work. It gives me a "0" for
>> each firm in Year 2006.
>> I want Stata to display the growth of Assets in eather
>> the 2006 line or 2007 line.
>>
>>
>>
>> I would be really really happy to receive an answer.
>>
>> Julian
>> *
>> * 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/
>
>
*
* 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/