#delimit; clear; global path C:; use $path/confucianism/datafiles/kapdata, clear; keep if year==2000|year==2003; keep if mbirthyear>=1960 & mbirthyear<=1979; *********************************; * This needs to be a measure of ; * sex preference intensity ; *********************************; gen type=0; replace type=1 if bstar==0; replace type=2 if bstar==1; replace type=3 if bstar>=2; drop if kstar==.|kstar==0; replace kstar=4 if kstar>4; egen groupnum=group(kstar type); label var kstar "Kstar"; table kstar, c(mean agefirst) f(%9.3f) stubwidth(8) cellwidth(9) csepwidth(1); table kstar type, f(%9.3f) stubwidth(8) cellwidth(9) csepwidth(1); table kstar type, c(mean agefirst) f(%9.3f) stubwidth(8) cellwidth(9) csepwidth(1); ex; /* Only execute this block if you need to do the table */ forvalues i=1980(10)2000{; bysort groupnum: egen grouptot`i'=sum(cen`i'==1); egen centot`i'=sum(cen`i'==1); bysort groupnum: gen groupshare`i'=grouptot`i'/centot`i'; bysort groupnum: egen meanage`i'=mean(agefirst) if cen`i'==1; }; gen cengroup=0; for numlist 1980(10)2000:replace cengroup=X if cenX==1; drop if cengroup==0; bysort cengroup groupnum: keep if _n==1; gen groupshare=0; for numlist 1980(10)2000:replace groupshare=groupshareX if cengroup==X; gen meanage=0; for numlist 1980(10)2000:replace meanage=meanageX if cengroup==X; table kstar type cengroup, c(mean groupshare) f(%9.3f) stubwidth(8) cellwidth(9) csepwidth(1); table kstar type cengroup, c(mean meanage) f(%9.3f) stubwidth(8) cellwidth(9) csepwidth(1); /**************/ ex;