I want to recode two of my value labels, which are used for multiple variables.
The first case is about q1-q10 which I previously encoded as followed:
Code:
label define decisionmanual 1 Myself and my husband/partner jointly 2 Husband/partner 3 Myself 4 Someone else in the family 5 Husband / partner foreach v of varlist q1-q10 { encode `v', gen(_`v') label(decisionmanual) order _`v', before(`v') drop `v' rename _`v' `v' }
Code:
"Myself" = 3, "Husband/partner" = 1, "Myself and my husband/partner jointly" = 2, "Husband / partner" = 1, "Someone else in the family" = 1)
1. Re-code: resulted in ''wrong'' labeling and 2. Drop decisionmanual: lost all labels, only numeric values were saved
Code:
foreach v of varlist q1 { recode `v' (5=1) (2=1) (1=2) (4=1) }
Code:
label define psychmanual 1 Never 2 Often 3 Sometimes foreach v of varlist q11-q20 { encode `v', gen(_`v') label(psychmanual) order _`v', before(`v') drop `v' rename _`v' `v' }
"Never" = 3, "Sometimes" = 2, "Often" = 1
and for q16-q20 it has to be:
"Never" = 1, "Sometimes" = 2, "Often" = 3
I hope this is clear!
0 Response to Value labels: re-coding, assigning multiple labels to one value and differentiation in variables
Post a Comment