Project

General

Profile

Support #2134 ยป kidlang_forum.do

 
global inpath "D:/"
cd "C:/Users/"

foreach w in a b c d e f g h i j k l {
use "$inpath/ukhls/`w'_indresp", clear
isvar pidp `w'_kidlang `w'_englang
keep `r(varlist)'
save `w'_lang
}
use a_lang, clear
foreach w in b c d e f g h i j k l {
merge 1:1 pidp using `w'_lang, nogen
}

gen englang=a_englang if inrange(a_englang,1,2)
foreach w in e f j {
replace englang=`w'_englang if inrange(`w'_englang,1,2) & ~inrange(englang,1,2)
}
lab val englang j_englang
fre englang


gen kidlang=b_kidlang if inrange(b_kidlang,1,97)
foreach w in f h {
replace kidlang=`w'_kidlang if inrange(`w'_kidlang,1,97) & ~inrange(kidlang,1,97)
}

lab val kidlang h_kidlang
fre kidlang

keep pidp kidlang englang
save lang, replace

use "$inpath/ukhls/c_indresp", clear
merge 1:1 pidp using lang
keep if _merge==3
drop _merge

fre c_cgna_dv if inrange(kidlang,1,97)
fre c_cgna_dv if inrange(englang,1,2)



    (1-1/1)