Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Questions on Merging Two Data sets(Individual and Household data)

From   Fredrik Wallenberg <>
Subject   Re: st: Questions on Merging Two Data sets(Individual and Household data)
Date   Sat, 22 May 2004 22:47:37 -0700

On Sat, 22 May 2004 02:05:53 -0700, Lok Wong <> wrote:
> Hi there,
> I have two data sets: one individual, another household. The observations in
> household data set are less than those in individual one
> because household consists of more than one individual. Now, I want to merge
> this two data sets. What should I do? In the invidiual data,
> there are two variables  "household id" and "number in the household" which
> could be used to identify invididuals uniquely. In the household
> data, there is one variales "household id".

The first question is whether you want to make your analysis at the
individual level or at the household level. The first is straight
forward. Sort (and save) the household level data and then use and
sort the individual data. After that you use

merge -hhid- using -hhdata-

This will add the hhdata to each individual observations with
individuals in the same household having the same household level
variables. The issue here is one of weighting but someone with a
better grasp of statistics/econometrics can probably provide you with
an appropriate correction.

In the other case you would want to use some aggregate characteristics
for the members of the household in household level data. Depending on
the characteristics you have this may end up being an average, a
count, a total or, in some cases, the characteristics associated with
the head of the household (ignorining the other members of the
household). You can create these variables (the first three at least)
using -compress, by hhid- and then merge on -hhid-.

I know this response isn't very deep, but the Stata implementation is
straight forward once you know what you want to accomplish.

*   For searches and help try:

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