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]
st: identifying the unique values across variables and creating new var equal to them
From
"Ivanova, K.O." <[email protected]>
To
"'[email protected]'" <[email protected]>
Subject
st: identifying the unique values across variables and creating new var equal to them
Date
Wed, 27 Feb 2013 12:19:34 +0000
Dear all,
I have a dataset where each row corresponds to a couple. Each partner within a couple was asked to report the birthdates of his / her children (not specified whether own or step). I need to find a way to identify the cases when one partner reported a birthdate which the other partner did not (this is the only way for me to identify children born outside the current union).
This is my data structure (the values are fictional, in my data the values as coded as century month codes; the variables starting with "par_" are based on the answers of the partner of the respondent):
id ch1 ch2 ch3 par_ch1 par_ch2 par_ch3
1 3 9 12 7 9 12
2 2 5 3 . . .
3 9 11 7 7 4 11
And I need to find a way, based on the data above, to create the following new variables (with their corresponding, for this example, values):
id ex1 ex2 ex3 par_ex1 par_ex2 par_ex3
1 3 . . 7 . .
2 2 5 3 . . .
3 9 . . . 4 .
Basically, I need to find a way to check the value of each birthdate against the rest of the birthdates reported *within* a couple. If that birthdate is reported by the other partner as well, the child is common and thus, of no interest for me. When the birthdate is unique within the couple, that child is a child only of the partner that reported it and the new variable should take the value of that birthdate.
I hope the example is clear and would appreciate any help I can get.
Katya
*
* 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/