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

st: merging household and person data


From   "Kompal Sinha" <[email protected]>
To   <[email protected]>
Subject   st: merging household and person data
Date   Mon, 11 Nov 2002 11:42:35 +1100

Hi there,
I have two data files: first containing the household(HH) data and second
containing person wise data for the corresponding HH.
I want to do the following:
1) In the person wise file which looks like this:
HHID           religion
12345             1
12345             2
12345             3
12334             4
12334             4
12334             4
12334             5

I want to generate a new variable count such as it counts the number of
persons in a particular household and assigns a number to it, like:
HHID           religion  count
12345             1        1
12345             2        2
12345             3        3
12334             4        1
12334             4        2
12334             4        3
12334             5        4

2) I want to merge the HH data and person data. The hh data has 60000 obs
and the person data has 180000 obs. I want to put the HH income from the
household data in front of each person of that HH in the person data like:
HHID           religion  count HHIncome
12345             1        1      50
12345             2        2      50
12345             3        3      50
12334             4        1      100
12334             4        2      100
12334             4        3      100
12334             5        4      100

How do I proceed?
Thanks in advance,
Kompal

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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