get file 's:\bhps\spss\dindresp.sav'/keep=pid,dvote,asex. sort cases by pid. save out = 'c:\temp\tempd.sav'. get file 's:\bhps\spss\eindresp.sav'/keep=pid,evote,esex. sort cases by pid. match files file=*/file='c:\temp\tempd.sav'/by=pid. missing values all (-9 thru -1). recode dvote evote (4 thru 10=7). cro dvote by evote by dsex/cell = count row.Stata:
use pid dvote dsex using s:\bhps\stata\dindresp sort pid save c:\temp\tempd,replace use pid evote esex using s:\bhps\stata\eindresp sort pid merge pid using c:\temp\tempd recode dvote -9/-1=. 4/10=7 recode evote -9/-1=. 4/10=7 bysort dsex: tab dvote evote, row
missing values all (-9 thru -1). reg dep=bfimn /method=enter afimn ajbstat asex amastat.
compute delta = bfimn - afimn. reg dep=delta /method=enter ajbstat asex amastat.
Stata:
recode bfimn -9/-1=1 recode ... xi: reg bfimn afimn i.ajbstat i.asex i.amastat
get delta = bfimn - afimn xi: reg delta i.ajbstat i.asex i.amastat
compute bempl = any(bjbstat,1,2). logistic bempl /cat ajbstat asex aregion /method = enter ajbstat asex aregion afimn.Stata:
gen bempl = inlist(bjbstat,1,2) xi: logit bempl i.ajbstat i.asex i.aregion afimn
ID Wave Empstat ID Wave Empstat P-empstat 1 1 1 1 1 1 . 1 2 1 ------> 1 2 1 1 1 3 4 1 3 4 1 1 4 1 1 4 1 4
add files file = 's:\bhps\spss\aindresp.sav' /rename(ajbstat=emp) /in=w1 /file = 's:\bhps\spss\bindresp.sav' /rename(bjbstat=emp) /in=w2 /file = 's:\bhps\spss\cindresp.sav' /rename(cjbstat=emp) /in=w3 /file = 's:\bhps\spss\dindresp.sav' /rename(djbstat=emp) /in=w4 /keep=pid,emp. if w1 wave=1. if w2 wave=2. * Continued.../ if w3 wave=3. if w4 wave=4. sort cases by pid,wave. if pid=lag(pid) pemp = lag(emp). exec. sel if not missing(pemp). missing values all (-9 thru -1). cro pemp by emp/cell = row count.Stata:
use ajbstat asex using s:\bhps\stata\aindresp gen wave=1 renpfix a save c:\temp\tempa,replace use bjbstat bsex using s:\bhps\stata\bindresp gen wave=2 renpfix b save c:\temp\tempb,replace use cjbstat csex using s:\bhps\stata\cindresp gen wave=3 renpfix c save c:\temp\tempc,replace use djbstat dsex using s:\bhps\stata\dindresp gen wave=4 renpfix d save c:\temp\tempd,replace use c:\temp\tempa append using c:\temp\tempb append using c:\temp\tempc append using c:\temp\tempd sort pid wave by pid: gen pjbstat=jbstat[_n-1]
cro pemp by emp by wave/cell = row count. . . . temp. sel if wave=4. cro pemp by emp/cell = row count.Stata:
tab pjbstat by jbstat if wave==4
|