So I have an individual level dataset, in which the household id (hhid) is not unique, however individual id (iid) is. Each observation has multiple variables like household income, some variables on assets, etc. Individual ids having the same hhid have duplicate observations. I want to reduce the dataset to a household level dataset.
hhid | iid | Income | Gender | House Type |
2084 | 145 | 11500 | Male | Flat with two rooms |
2084 | 123 | 11500 | Female | Flat with two rooms |
2085 | 23 | 15000 | Male | Apartment |
2085 | 14 | 15000 | Female | Apartment |
hhid | Members | Income | House Type |
2084 | 2 | 11500 | Flat with two rooms |
2085 | 2 | 15000 | Apartment |
Edit: Tried using collapse, but it is not working on the string variables. The variable 'House Type' should also be reduced to one observation per hhid.
0 Response to Combining observations within the same dataset
Post a Comment