/******************* session 1: preparing datafile for usage Johanna Sophie Quis Bamberg Graduate School of Social Sciences (BAGSS) University of Bamberg Data: National Educational Panel Study (NEPS) - Additional Study Baden-Wurttemberg(BW A72 - A74, Version D_3-0-0) Procedure: 1. start by loading CohortProfile 2. directly match information from a) xTarget and b) xInstitution dataset (works only remonte) 3. set labels to English 4. recode missings 5. Save data for analysis ********************/ // initialize working environment *do "init.do" local sessionnum 1 // open log file log using "${logDir}session`sessionnum'.smcl", smcl replace name(smcl) log using "${logDir}session`sessionnum'.log", text replace name(txt) * 1.) load Study Profile use "${dataDir}BW_Profile_${version}", clear * 2.) a) directly match information from xTarget *(merge row by row uniquely identified by ID_t, keep only matched cases) merge 1:1 ID_t using "${dataDir}BW_xTarget_${version}", nogenerate keep(matched) merge 1:1 ID_t using "${dataDir}BW_xTargetCompetencies_${version}", nogenerate keep(matched) * b) merge file xInstitution (consider missing parent IDs for some children) *nepsmiss ID_i //recode NEPS missings to stata missings * since there are missings in ID_p there is a m:1 relationship for merge *merge m:1 ID_i using "${dataDir}BW_xInstitution_${version}", nogenerate keep(master matched) keepusing(p700010) *3.) set labels to English label language en * label variables in English that did not convert to English above la var t1a "Well-being life" la var t1b "satisfaction with standard of living" la var t1c "satisfaction with health" la var t1d "satisfaction with family life" la var t1f "Well-being school" la var t42a "Self-assessment - memory" la var t42b "Self-assessment - pleasure going to school" la var t42c "Self-assessment - comparison with others" la var t42d "Self-assessment - remembering of specific course materials" la var t42e "Self-assessment - studying is fun" la var t42f "Self-assessment - little talented compared to other" la var t42g "Self-assessment - satisfaction with school" la var t42h "Self-assessment - feeling at ease in school" la var t42i "Self-assessment - in comparison not as clever" la var t42j "Self-assessment - remembering of materials learned" la var t5a "Stress - tension after school" la var t5b "Stress - falling asleep" la var t5c "Stress - irritable reaction" la var t5d "Stress - excessive demand" la var t5e "Stress - free time" la var t5f "Stress - demands at school generally" la var t5g "Stress - exhaustion" la var t5h "Stress - illness at ease" la var t5i "Stress - pressure" la var t5j "Stress - overexertion" la var t5k "Stress - combine school and commitments" la var t5l "Stress - tiredness and weariness" la var t5m "Stress - recovery" la var t5n "Stress - relaxation" la var t5o "Stress - missing time" la var t76 "Books at home" la var txg8 "Reform (G8)" */ * 4.) recode missings /*mvdecode _all, mv(-20=.a \ -21=.b \ -25=.c \ -54=.d \ -55=.e \ -56=.f \ -90=.g \ -93= .h \ -95=.i \ -98=.j \ -24=.k \ -23=.l \ -27=.m) labelmiss .a "Ausland aber nicht codierbar", modify labelmiss .b "Deutschland und ein anderes Land, nicht codierbar", modify labelmiss .c "nicht valide", modify labelmiss .d "Designbedingt fehlend", modify labelmiss .e "Nicht ermittelbar", modify labelmiss .f "nicht teilgenommen", modify labelmiss .g "nicht spezifizierbar fehlend", modify labelmiss .h "trifft nicht zu" , modify labelmiss .i "unplausibler Wert" , modify labelmiss .j "Weiß nicht", modify labelmiss .k "nicht bestanden", modify labelmiss .l "nicht zugelassen", modify labelmiss .m "nicht vorliegend", modify */ nepsmiss _all mvdecode _all, mv(-55=.l \ -98=.b \-27=.l ) //-27 wird auch als "not determinable" (wie -55) eingetragen bedeutet eigentlich "not present" * save datafile for save "${dataDir}mentalhealth", replace // close log files log close txt log close smcl