|
// Author: Gundi Knies (ISER University of Essex)
|
|
// This Stata programme can be run on Understanding Society Wave 7 (2017) g_youth.dta to replace
|
|
// erraneous derived variables reporting the Strength and Difficulties Questionnaire composite scores.
|
|
// Note that the source of the problem affects other variables: Many variables include the value 9"Invalid answer"
|
|
// which should be recoded to -9 "missing or wild". The error will be fixed for the next release of Understanding Society
|
|
// data, planned for Summer 2018.
|
|
use g_youth.dta, clear
|
|
drop g_ypsdqes_dv g_ypsdqcp_dv g_ypsdqha_dv g_ypsdqpp_dv g_ypsdqps_dv g_ypsdqtd_dv
|
|
/*SDQ Scoring*/
|
|
*Scoring adjustment*
|
|
global vloop1 "g_ypsdqa g_ypsdqb g_ypsdqc g_ypsdqd g_ypsdqe g_ypsdqf g_ypsdqh"
|
|
global vloop2 "g_ypsdqi g_ypsdqj g_ypsdql g_ypsdqm g_ypsdqo g_ypsdqp g_ypsdqq"
|
|
global vloop3 "g_ypsdqr g_ypsdqs g_ypsdqt g_ypsdqv g_ypsdqw g_ypsdqx"
|
|
global vloop "${vloop1} ${vloop2} ${vloop3}"
|
|
foreach var of global vloop {
|
|
replace `var'=. if !inlist(`var',1,2,3)
|
|
gen `var'r=`var'-1
|
|
}
|
|
*Reverse Scoring*
|
|
global vloop "g_ypsdqg g_ypsdqk g_ypsdqn g_ypsdqu g_ypsdqy"
|
|
foreach var of global vloop {
|
|
replace `var'=. if !inlist(`var',1,2,3)
|
|
omscore `var'
|
|
gen `var'r=rr_`var'-1
|
|
}
|
|
/*Creating SDQ Subscales. NB. Subscales can be computed as long as there are no missings on at least 3 out of ///
|
|
5 items forming the scale*/
|
|
egen n_emotion=robs(g_ypsdqcr g_ypsdqhr g_ypsdqmr g_ypsdqpr g_ypsdqxr)
|
|
egen g_ypsdqes_dv =rmean(g_ypsdqcr g_ypsdqhr g_ypsdqmr g_ypsdqpr g_ypsdqxr) if n_emotion>2 & n_emotion~=.
|
|
replace g_ypsdqes_dv =round(g_ypsdqes_dv*5)
|
|
|
|
egen n_conduct=robs(g_ypsdqer g_ypsdqgr g_ypsdqlr g_ypsdqrr g_ypsdqvr)
|
|
egen g_ypsdqcp_dv=rmean(g_ypsdqer g_ypsdqgr g_ypsdqlr g_ypsdqrr g_ypsdqvr) if n_conduct>2 & n_conduct~=.
|
|
replace g_ypsdqcp_dv=round(g_ypsdqcp_dv*5)
|
|
|
|
egen n_hyper=robs(g_ypsdqbr g_ypsdqjr g_ypsdqor g_ypsdqur g_ypsdqyr)
|
|
egen g_ypsdqha_dv=rmean(g_ypsdqbr g_ypsdqjr g_ypsdqor g_ypsdqur g_ypsdqyr) if n_hyper>2 & n_hyper~=.
|
|
replace g_ypsdqha_dv=round(g_ypsdqha_dv*5)
|
|
|
|
egen n_peer=robs(g_ypsdqfr g_ypsdqkr g_ypsdqnr g_ypsdqsr g_ypsdqwr)
|
|
egen g_ypsdqpp_dv=rmean(g_ypsdqfr g_ypsdqkr g_ypsdqnr g_ypsdqsr g_ypsdqwr) if n_peer>2 & n_peer~=.
|
|
replace g_ypsdqpp_dv=round(g_ypsdqpp_dv*5)
|
|
|
|
egen n_prosoc=robs(g_ypsdqar g_ypsdqdr g_ypsdqir g_ypsdqqr g_ypsdqtr)
|
|
egen g_ypsdqps_dv=rmean(g_ypsdqar g_ypsdqdr g_ypsdqir g_ypsdqqr g_ypsdqtr) if n_prosoc>2 & n_prosoc~=.
|
|
replace g_ypsdqps_dv=round(g_ypsdqps_dv*5)
|
|
|
|
*SDQ Total Difficulties Score*
|
|
gen g_ypsdqtd_dv = g_ypsdqes_dv + g_ypsdqcp_dv + g_ypsdqha_dv + g_ypsdqpp_dv
|
|
|
|
label variable g_ypsdqes "SDQ Subscale: Emotional Symptoms"
|
|
label variable g_ypsdqcp "SDQ Subscale: Conduct Problems"
|
|
label variable g_ypsdqha "SDQ Subscale: Hyperactivity/Inattention"
|
|
label variable g_ypsdqpp "SDQ Subscale: Peer Relationship Problems"
|
|
label variable g_ypsdqps "SDQ Subscale: Prosocial"
|
|
label variable g_ypsdqtd "SDQ Total Difficulties Score"
|
|
|
|
global vloop "g_ypsdqes_dv g_ypsdqcp_dv g_ypsdqha_dv g_ypsdqpp_dv g_ypsdqps_dv g_ypsdqtd_dv"
|
|
foreach var of global vloop {
|
|
recode `var' (.=-9)
|
|
lab def `var' -9 "missing", replace
|
|
lab val `var' `var'
|
|
fre `var'
|
|
}
|
|
keep pidp *_dv
|
|
order g_hidp g_pno
|
|
sort g_hidp g_pno
|
|
lab dat "SDQ, person-level DV, correction 2018-01-02"
|
|
save g_ypsdq_dv_c.dta, replace
|
|
|
|
|
|
|