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: RE: RE: need reshape help


From   "Averett, Susan L" <[email protected]>
To   [email protected]
Subject   Re: st: RE: RE: need reshape help
Date   Wed, 9 Jun 2010 12:54:15 -0400 (EDT)

Seemed to work beautifully. Thanks!

----- Original Message -----
From: "Nick Cox" <[email protected]>
To: [email protected]
Sent: Tuesday, June 8, 2010 9:42:22 AM GMT -05:00 US/Canada Eastern
Subject: st: RE: RE: need reshape help

I've not thought of how smart this is for 3 or more siblings. But I have previously discussed trickery that could help under this heading: 

SJ-8-4  dm0043  . Tip 71: The problem of split identity, or how to group dyads
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        Q4/08   SJ 8(4):588--591                                 (no commands)
        tip on how to handle dyadic identifiers

Nick 
[email protected] 

Nick Cox

bysort famid aid : gen j = _n
reshape wide pair, i(famid aid) j(j)

Nick 
[email protected] 

Averett, Susan L

I have a data set that I need to reshape. I have two id codes that TOGETHER uniquely identify each individual in my survey.
FAMID is a number and AID is a strong. I have a variable pair, that identifies what type of sibling they are. Respondents can be in more than one pair if three or more siblings from the same family were interviewed.   The data are currently in this form:

FAMID                PAIR                AID
123                TWMM123        10
123                TWMM123        20
123                FSMF001        30
123                FSMF001        10
123                FSMF002        30
123                FSMF002        20

I need the specific pair designations for each respondent, so I need to reshape the to create several PAIR variables so the file looks like this:

FAMID                PAIR1        AID        PAIR2
123                TWMM123        10        FSMF001
123                TWMM123        20        FSMF002
123                FSMF001        30        FSMF002

BUT, I can't figure out how to do it using reshape. Any help would be appreciated.


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