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: Generating variable in panel dataset
From
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: Generating variable in panel dataset
Date
Wed, 29 Dec 2010 14:38:11 +0000
I am rarely clear why people want to degrade quantitative information
in this way, but some technique is shown by
su stroke if year == 2002, detail
bysort county (year) : gen low = stroke[1] < r(p50)
Nick Cox
(N.B. For "a ... data" read "a ... dataset".)
Shikha Sinha
> 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"?
*
* 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/