Dear Statalisters,
I realise parts of this question have been addressed across several threads though I think this current request will help a lot of people with the same problem.
I have a string variable treat where "1"=exposed and "0"=unexposed
When I encode treat, gen(treat_cde) the value labels have changed to "2"=exposed and "1"=unexposed
Some commands won't work with a treatment variable not labeled as "1" and "0" (eg. pbalchk).
How can one encode the string variable whilst preserving the original value labels?
I have attempted to use the command recode with little success.
When I applied recode treat_cde (2=1) all the data are changed to "1"s.
Many thanks,
Alexander
I realise parts of this question have been addressed across several threads though I think this current request will help a lot of people with the same problem.
I have a string variable treat where "1"=exposed and "0"=unexposed
When I encode treat, gen(treat_cde) the value labels have changed to "2"=exposed and "1"=unexposed
Some commands won't work with a treatment variable not labeled as "1" and "0" (eg. pbalchk).
How can one encode the string variable whilst preserving the original value labels?
I have attempted to use the command recode with little success.
When I applied recode treat_cde (2=1) all the data are changed to "1"s.
Many thanks,
Alexander
Comment