qui { /* ===================================================== * Author: Jan Goebel * * Date: 03. June 2004 * * * * This script converts the "normal" SOEP data files * * (100 or 95%) into the SOEP Teaching Version (50 %) * * * * =====================================================*/ clear set mem 200m /*#delimit;*/ set more off /* =========================================== */ /* Here you can define the correct directories */ /* Note the trailing slashes! */ /* If you define soepdatadir and outdatadir */ /* to be the same the original SOEP data */ /* will be OVERWRITTEN with the teaching */ /* version!!! */ /* =========================================== */ /*local soepdir = "I:/soep24_de/stata/"*/ /*local schooldir = "c:/temp/school/" */ local soepdir = "~/make_v29/stata_de+en/" local schooldir = "./stata50/" local soepversion = "SOEP.v29" /* hopefully no changes necessary below here. */ } qui { local allfiles : dir "`soepdir'" files "*.dta" local starttime $S_TIME noi display in red "Now convert all files to the 50% version, be patient ..." noi display in red "Or go and get a coffee -)" use `soepdir'/cirdef sort hhnr save `soepdir'/cirdef, replace clear foreach file in `allfiles' { local dof = substr( "`file'", 1 , index("`file'", ".") - 1) noi display in green "Using ", in yellow %13s "`file'" use `soepdir'`file', clear sort hhnr merge hhnr using `soepdir'/cirdef, nokeep drop _merge keep if rgroup20>10 noi tab1 rgroup20 if "`file'" != "cirdef.dta" { drop rgroup20 ksample } label data "`soepversion'@school: `file'" save `schooldir'`file', replace } clear local endtime $S_TIME noi display in green "" noi display in green "--------------------------------------------------------------" noi display in green "Start: `starttime' End: `endtime'" noi display in green "Happy teaching with the SOEP, on behalf of the whole SOEP Team" noi display in green " Jan Goebel" noi display in green "--------------------------------------------------------------" }