I’ve been working on a large panel study. We’ve reshaped a database for the entire population by address to get up to 12 household members for each address. I then used address to match the panel members to household members.
The household members include some data about the panel member. One way around this is to use name and age to identify the panel member. Loops to identify the number of people of a particular race or the oldest person in the household can easily be written to exclude the panelist.
dataex id forename surname house street year panel_14_fm fore_14_fm_1 sur_14_fm_1 race_14_fm_1 start_yr_14_fm_1 fore_14_fm_2 sur_14_fm_2 race_14_fm_2 star
> t_yr_14_fm_2
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte id str7(forename surname) byte house str11 street int year byte panel_14_fm str7 fore_14_fm_1 str9 sur_14_fm_1 byte race_14_fm_1 int start_yr_14_fm_1 str5 fore_14_fm_2 str10 sur_14_fm_2 byte race_14_fm_2 int start_yr_14_fm_2 1 "" "Who" . "Tardis" 1776 2 "Tegan" "Jokanovic" 1 1960 "" "Who" 1 1776 2 "Barbara" "Wright" 17 "Coroonation" 1940 1 "Barbara" "Wright" 1 1940 "Ian" "Chesterton" 1 1940 3 "Ben " "Jackson" 32 "Every" 1935 1 "Ben" "Jackson" 1 1935 "Polly" "Jackson" . 1940 4 "Vicky" "Water" . "London" 1850 2 "Jamie" "McCrimmon" 1 1730 "Vicky" "Water" 1 1850 end
Code:
forvalues j = 1/2 { replace fore_14_fm_`j'="" if panel_14_fm==`j' replace sur_14_fm_`j'="" if panel_14_fm==`j' replace race_14_fm_`j'=. if panel_14_fm==`j' replace start_yr_14_fm_`j'=. if panel_14_fm==`j' *… }
dataex id forename surname house street year panel_14_fm fore_14_fm_1 sur_14_fm_1 race_14_fm_1 start_yr_14_fm_1 fore_14_fm_2 sur_14_fm_2 race_14_fm_2 star
> t_yr_14_fm_2
copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte id str7(forename surname) byte house str11 street int year byte panel_14_fm str7 fore_14_fm_1 str9 sur_14_fm_1 byte race_14_fm_1 int start_yr_14_fm_1 str5 fore_14_fm_2 str10 sur_14_fm_2 byte race_14_fm_2 int start_yr_14_fm_2 1 "" "Who" . "Tardis" 1776 2 "Tegan" "Jokanovic" 1 1960 "" "" . . 2 "Barbara" "Wright" 17 "Coroonation" 1940 1 "" "" . . "Ian" "Chesterton" 1 1940 3 "Ben " "Jackson" 32 "Every" 1935 1 "" "" . . "Polly" "Jackson" . 1940 4 "Vicky" "Water" . "London" 1850 2 "Jamie" "McCrimmon" 1 1730 "" "" . . end
Code:
forvalues j = 1/2 { replace fore_14_fm_`j'=fore_14_fm_`j+1' if sur_14_fm_`j'=="" }
Matthew Gibbons
0 Response to Deleting household member when panelist and moving other household members into the gap
Post a Comment