Support #382
closed*_sex (not *_sex_cr) in egoalt file
100%
Description
Hello, I've been looking at gender in the egoalt file and it appears that ego gender is based on *_sex, rather than *_sex_cr.
I've found 54 cases with different *_sex and *_sex_cr values. In all cases, the ego-alt file contains data corresponding to *_sex, not *_sex_cr (thus, the miscoded data, rather than actual gender).
My Stata syntax file spotting this problem is below (inresp gender only shown for years when _sex and _sex_cr are inconsistent).
Dave
global path1 "C:\data\under_society\data\"
global path9 "C:\temp\"
foreach wave in a b c d {
use pidp `wave'_sex `wave'_sex_cr using ///
$path1\`wave'_indresp.dta, clear
drop if `wave'_sex `wave'_sex_cr
sort pidp
save $path9\sex`wave'.dta, replace
}
use $path9\sexa.dta, clear
foreach wave in b c d {
sort pidp
merge 1:1 pidp using $path9\sex`wave'.dta
drop _merge
}
save $path9\sex_cr.dta, replace
foreach wave in a b c d {
use pidp `wave'_esex ///
using $path1\`wave'_egoalt.dta, clear
duplicates drop
save $path9\ego`wave'.dta, replace
}
use $path9\egoa.dta, clear
foreach wave in b c d {
sort pidp
merge 1:1 pidp using $path9\ego`wave'.dta
drop _merge
}
sort pidp
merge 1:1 pidp using $path9\sex_cr.dta
keep if _merge3
list