Hi,
I am defining and attaching value and variable labels, and I really need help on how to use loops to accomplish them. Any practical insights in this direction?
a) How can I apply a loop over the definition and attachment of the following value labels?
label define ltrtd 0 "NSW control" 1 "NSW treated"
label define lblk 0 "else" 1 "black"
label define lmar 0 "else" 1 "married"
label define lnod 0 "H.S. diploma" 1 "no diploma"
label define lhis 0 "else" 1 "hispanic"
label define lsam 1 "NSW randomized" 2 "CPS comparison" "PSID comparison"
label values treated ltrtd
label values black lblk
label values married lmar
label values nodegree lnod
label values hisp lhis
label values sample lsam
b) How can I apply a loop to label the following variables?
label variable treated "NSW randomized group"
label variable age "age of individual"
label variable educ "years of schooling"
label variable black "race is black"
label variable married "status is married"
label variable nodegree "no high school diploma"
label variable re78 "real $ earnings in 1978"
label variable hisp "race is hispanic"
label variable sample "NSW, CPS and PSID sample"
Thanks in advance for your help.
Eric
I am defining and attaching value and variable labels, and I really need help on how to use loops to accomplish them. Any practical insights in this direction?
a) How can I apply a loop over the definition and attachment of the following value labels?
label define ltrtd 0 "NSW control" 1 "NSW treated"
label define lblk 0 "else" 1 "black"
label define lmar 0 "else" 1 "married"
label define lnod 0 "H.S. diploma" 1 "no diploma"
label define lhis 0 "else" 1 "hispanic"
label define lsam 1 "NSW randomized" 2 "CPS comparison" "PSID comparison"
label values treated ltrtd
label values black lblk
label values married lmar
label values nodegree lnod
label values hisp lhis
label values sample lsam
b) How can I apply a loop to label the following variables?
label variable treated "NSW randomized group"
label variable age "age of individual"
label variable educ "years of schooling"
label variable black "race is black"
label variable married "status is married"
label variable nodegree "no high school diploma"
label variable re78 "real $ earnings in 1978"
label variable hisp "race is hispanic"
label variable sample "NSW, CPS and PSID sample"
Thanks in advance for your help.
Eric
Comment