Bookmark and Share

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   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Arranging variables across rows
Date   Wed, 27 Jun 2012 19:04:21 +0100

Have you actually tried my code?

I cycle over all cross-combinations of the A* and B*, so that should
not be a problem.

Also, your word translation is a mistranslation of the code.

Nick

On Wed, Jun 27, 2012 at 6:58 PM, samuel gyetvay <[email protected]> wrote:
> 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.
>

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index