2.2 Adding in info from other files

Much important information is not included in wINDRESP. Household information is in wHHRESP, non-changing individual data in XWAVEDAT and so on.

This example matches in household monthly income and calculates the share represented by the individual's monthly income. Within waves, one can match on wHID, or wHID and wPNO.

Note that because this is a many-to-one match, SPSS uses a /TABLE subcommand for the household file, not /FILE.

SPSS Syntax:

get file "s:\bhps\spss\aindresp.sav"/keep=pid,ahid,afimn.
match files file=*/table="s:\bhps\spss\ahhresp.sav"
  /by=ahid.
missing values all (-9 thru -1).
compute indprop1 = afimn/afihhmn.

Stata syntax:

use pid ahid afimn using s:\bhps\stata\aindresp
sort ahid
save m:\tempa, replace
use ahid afihhmn using s:\bhps\stata\ahhresp
sort ahid
merge ahid using m:\tempa
keep if _merge==3
gen indprop1 = afimn/afihhmn
replace indprop1 = . if afimn<0 | afihhmn < 0

Proceed with this strategy and make a cross-wave file containing INDPROPn, the individual share of household monthly income - see how stable or otherwise this is over time.



© Brendan T. Halpin (e-mail), GNU Free Documentation Licence