************************************************************ ************************************************************ *** *** *** Do-file for working with pairfam data *** *** DECODING OF MISSING VALUES (ANCHOR) *** *** Release 13.0 *** *** *** *** May 2022 *** *** *** *** Author: Renate Lorenz *** *** *** ************************************************************ ************************************************************ /* This dofile decodes the original missing values (negative numbers) to different kinds of system missings (.a to .j) that can be used for data analysis. The dofile is applicable to all ANCHOR data (including Demodiff). For more information on missings, see the Data Manual, Chapter 4. Notes: 1) In the German version, the generated variables will have English missing labels, while the rest of the value labels are in German. 2) The generated variables physical health (pcs) and mental health (mcs) contain negative values that are not recoded in this dofile. For more information on these variables, see the Data Manual, Chapter 4. 3) The ISCO and KldB classification scheme (isco08, kldb2010) contain categories with negative values (from -100 to -10), that are not part of the official scheme. If you wish to preserve this information, please recode the negative values before decoding missing values. For more information on these variables, see the Data Manual, Chapter 4. 4) Attention for waves 12 and 13: Before running the dofile please append the datasets anchor$_capi.dta and anchor$_cati.dta, and name the combined dataset anchor$.dta. For more information on the mode change in W12 and W13, please see the Data Manual, Chapter 12. */ ******************************************************************************** clear all set more off // tells Stata not to pause for --more-- messages set maxvar 10000 // increases maximal number of variables * Definition of globals global inpath `""insert your datapath here""' // directory of original pairfam data global outpath `""insert your datapath here""' // working directory global dataset `""insert name of dataset here""' // e.g., "anchor11" * Open dataset cd $inpath use $dataset, clear ************************************************************* *** *** *** Decoding of negative values to system missings *** *** *** ************************************************************* * Special cases: Decode negative values of isco08 and kldb2010 to system missings mvdecode isco08, mv(-100/-10=.) mvdecode kldb2010, mv(-100/-10=.) * Regular cases: Decode negative values to different kinds of system missings foreach var of varlist _all { capture confirm numeric variable `var' if !_rc { *Decode missings mvdecode `var', mv(-1=.a\-2=.b\-3=.c\-4=.d\-5=.e\-6=.f\-7=.g\-77=.g\-10=.h\-11=.i\-12=.j) *German labels label language de local lab: value label `var' if "`lab'"!="" { label define `lab' /// .a "-1 Weiß nicht" /// .b "-2 Keine Angabe" /// .c "-3 Trifft nicht zu" /// .d "-4 Fehleingabe/Filterfehler" /// .e "-5 Inkonsistenter Wert" /// .f "-6 Offene Angabe nicht lesbar" /// .g "-7 Unvollständige Daten" /// .h "-10 Nicht in demodiff" /// .i "-11 Nicht in pairfam" /// .j "-12 Non-response PAPI", modify lab values `var' `lab' } *English labels label language en local lab: value label `var' if "`lab'"!="" { label define `lab' /// .a "-1 Don´t know" /// .b "-2 No answer" /// .c "-3 Does not apply" /// .d "-4 Filter error / Incorrect entry" /// .e "-5 Inconsistent value" /// .f "-6 Unreadable answer" /// .g "-7 Incomplete data" /// .h "-10 Not in demodiff" /// .i "-11 Not in pairfam" /// .j "-12 Non-response PAPI", modify lab values `var' `lab' } } } * Save dataset label language de cd $outpath save "insert new dataset name here", replace