Hello,
I have a stumbling block. I have some variables that were recorded as string because they include a value 'DK' for dont know. If I use encode this works great for variables without missing values. However, I also have some variables that have DK and missing values. When I use encode the missing values are recoded as '1' and all my other data is changed. Is there a way to encode and tell stata to recognise blanks as MV?
If I try to destring the variable I get 'Q1_7: contains nonnumeric characters; no replace'. If I try to recode the DK to . I get the error 'recode only allows numeric variables r(108);'
Does anyone have a solution on how to get rid of this pesky DK without changing the values or my other observations in the variable? IF so, is it possible to do it for my whole database or do i need to do it one variable by one?
Thanks!
I have a stumbling block. I have some variables that were recorded as string because they include a value 'DK' for dont know. If I use encode this works great for variables without missing values. However, I also have some variables that have DK and missing values. When I use encode the missing values are recoded as '1' and all my other data is changed. Is there a way to encode and tell stata to recognise blanks as MV?
If I try to destring the variable I get 'Q1_7: contains nonnumeric characters; no replace'. If I try to recode the DK to . I get the error 'recode only allows numeric variables r(108);'
Does anyone have a solution on how to get rid of this pesky DK without changing the values or my other observations in the variable? IF so, is it possible to do it for my whole database or do i need to do it one variable by one?
Thanks!
Comment