[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: -merge- which one would make sense?

From   David Bell <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: -merge- which one would make sense?
Date   Thu, 22 May 2008 08:56:02 -0400


I am assuming that there are only two persons in a household for whom maritalstatus==1 (no married grandmother-grandfathers). If so, you don't need to save and merge. You can just do -keep if maritalstatus==1-. At this point sex identifies spouses (unless you have any same-sex marriages). If you have multiple marriages within a household, you would need to do something to distinguish them, for example giving each marriage a different variation on the original hhid.

The essential question for what to do depends on what sort of analyses you intend. Clearly, you can analyze the married study participants as individual cases; you would probably want to use -, cluster(hhid)- options to adjust variances for within household similarities.

If you want to do dyadic analyses (husband's values affect wife's and vice versa), you need to do something as the following:
sort hhid sex /* So husbands and wives are in the same order in each family */
by hhid: gen spouseVar = ownVar[_n+1] if sex==1
by hhid: replace spouseVar = ownVar[_n-1] if sex==2

Hope this helps.
David C. Bell
Professor of Sociology
Indiana University Purdue University Indianapolis (IUPUI)
(317) 278-1336

On May 22, 2008, at 6:02 AM, Nirina F wrote:

Dear Friedrich,

Thank you again for responding.

My problem is that I do not have a relationship to household head but
I only have the line number of each respondent.


On 5/21/08, Friedrich Huebler <[email protected]> wrote:

Let's say we have the household below. Assume that the two
40-year-olds are married and that the 50-year-old man is married to
the 30-year-old woman. Your code merges the 50-year-old man with the
40-year-old woman and the 40-year-old man with the 30-year-old woman,
which would be wrong. Given only the data below it is not possible to
identify married couples. You need something like line number of the

hhid sex age maritalstatus
1    1   50  1
1    1   40  1
1    2   40  1
1    2   30  1
1    1   5   0
1    2   3   0

It may help if you read two Stata FAQs about data on families.


On Wed, May 21, 2008 at 6:52 PM, Nirina F <[email protected]> wrote:
Dear David and Friedrich,

You are right, within one household, there are the wife and husband,
children and other people like mother of husband.
This is the code I used originally:

Using the original data:

keep if sex==1 & maritalstatus==1
foreach x of var * {
      rename `x' h_`x'

gen hid=h_hhid
sort hid
save  husband.dta

keep if sex==2 & maritalstatus==1
foreach x of var * {
      rename `x' w_`x'
gen hid=w_hhid
sort hid
save wife.dta
merge using husband.dta

I also tried to include line number of respondent after each -keep-
but it does not give me the answer where answers from husband on hh
characteristics should match wive's.
I am looking into details of what I have.
thank you,

On 5/21/08, Friedrich Huebler <[email protected]> wrote:

Further to my earlier question, I assume you have a variable that
identifies the marital status of each household member. Your
description is not clear but from what I understand you selected men
and women whose marital status is "married" and then assumed that a
married man and a married woman in the same household are each other's
spouse. Is this what you did? What did you do with households with
more than one married man and woman?

Other possibilities are that you have a variable with the line number
of each household member's spouse or a variable that describes the
relationship to the household head. Either way, we need more
information in order to help you.


On Wed, May 21, 2008 at 10:56 AM, Friedrich Huebler <[email protected] > wrote:


First, please include the Stata commands you used.

Second, how do you identified husbands and wives? A married man and a
married woman living in the same household are not necessarily married
to each other.


On Wed, May 21, 2008 at 8:29 AM, Nirina F <[email protected]> wrote:

I have a microdataset with 5000 individuals. In the data, I have
household questionnaires and individual questionnaires together, pid,

I did the following scenarios and now I'm lost:

1- I separated the household(hh) questionnaire from the individual(i)
I split the remaining individual questionnaires into married female
and married male renamed all variables accordingly.
Then I merged the male and female because they are husband and wife by
their household id. I had 2000 households
Afterward, I merged the hh questionnaire. I end up back to 5000 observations.

2- I kept the original dataset and just split into two datasets
married female and married male which I merged afterward to have
husband and wives. I arrive at 2000 observations.
When I assert if household information from husband and wife is the
same, almost 90% of the observation is false.

What do you think I should do? Which one of the two should make sense?
Thank you very much from your help.

*   For searches and help try:

*   For searches and help try:
*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index