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: Arranging variables across rows
From
samuel gyetvay <[email protected]>
To
[email protected]
Subject
Re: st: Arranging variables across rows
Date
Wed, 27 Jun 2012 13:58:07 -0400
Nick, your "clumsy" code does not solve the problem, which is that A*
and B* do not always or necessarily line up. So, if you create a dummy
variable equal to 1 when A'`i' = B`j', several cases would not be
counted. Consider the case where only the fourth child received
treatment:
(A1) (A2) (A3) (A4) (B1) (B2) (B3) (B4)
101 102 103 104 104 . . .
your code would produce D1, D2, D3, and D4 all equal to 0, despite the
fourth child having received treatment.
It appears that your first suggestion, followed by
bysort family (person) : gen col = _n
reshape wide person treated , i(family) j(col)
has worked. I want to perfectly understand each step, and am reading
through very carefully, referring to definitions of each command used,
etc. so that I can properly document my work. I will let you know if I
have any other questions, perhaps in trying to fit the new variable
"treated" back into the original dataset.
Thank you again,
-Sam
*
* 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/