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: Creating variables from a matched pair


From   David Kantor <[email protected]>
To   [email protected]
Subject   Re: st: Creating variables from a matched pair
Date   Mon, 08 Oct 2012 14:33:12 -0400

At 02:15 PM 10/8/2012, Jessica Kopsic wrote:

I have a dataset with matched pairs, and I'd like to create a dataset where each person's partner's observations are variables. So like this:
Partner A: DOB Partner A, DOB Partner B, Sex Partner A, Sex Partner B

Currently everything is in this format:
Partner A: DOB Partner A, Sex Partner A
Partner B: DOB Partner B, Sex Partner B

The ID numbers are structured like this:
1A01
1B01
1A02
1B02
2A01
2B01
2A02
2B02
The numbers at the beginning are rounds. Then partner A or B. Then numbers that match the pair together. The number sets got reused for each round so numbers may or may not be unique throughout the whole dataset, but they are restricted to one set of partners for each round. (So IDs are unique throughout the whole dataset.)

This dataset will be used in other programs, so I'd like to create the dataset up front rather than match during analyses. I'm flummoxed by this one and came up empty searching archives. Thank you.

You need to be a bit more specific about what the data look like and what the desired result looks like. But from a brief look, this may be a case for -reshape wide-. -reshape wide- will yield one observation for each pair. If you want two observations for each pair -- the second one with the roles reversed -- then you need to do some additional work, but it is not hard.
Tell us more, and we'll be better able to help.
--David

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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