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]
st: Generating variable in panel dataset
From
Shikha Sinha <[email protected]>
To
[email protected]
Subject
st: Generating variable in panel dataset
Date
Tue, 28 Dec 2010 18:57:47 -0500
Dear all,
I have a county level panel data for two years: 2002 and 2008. I want
to create a binary variable "low" which categorizes counties by median
value of variable stroke in 2002. For example.
County Year Avg stroke Low
A 2002 0.12 1
B 2002 0.17 1
C 2002 0.20 1
D 2002 0.24 0
E 2002 0.28 0
A 2008 0.10
B 2008 0.11
C 2008 0.34
D 2008 0.45
E 2008 0.23
In year 2002, the median value of stroke is 0.20, and I have coded
counties with avg stroke <= median stroke as low. so, A, B, C are
low=1 and D.E are low=0.
Now I want to code A,B, C in 2008 as low=1 and D,E as low=0. I do not
want to consider abg stroke in these counties in 2008. Is there a
simple way to complete the column "low"?
Hope my query is clear.
Thanks.
Shikha
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/