Dear Statalists,
My data set has a "name" variable, which is a string variable with individual names. However, there are many missing names in the list (i.e., zero string). I would like to create a dummy variable that shows 1 for any name, and 0 for missing. How can I create a code for that?
I tried
gen namedummy=.
replace namedummy =1 if name==" "
I got "0 changes made".
My data set has a "name" variable, which is a string variable with individual names. However, there are many missing names in the list (i.e., zero string). I would like to create a dummy variable that shows 1 for any name, and 0 for missing. How can I create a code for that?
I tried
gen namedummy=.
replace namedummy =1 if name==" "
I got "0 changes made".
Comment