Hi all,
For my final project I am trying to clean my data and change a current variable "phtn" which has responses as Yes and No into a new variable ("confirmed" with 1 and 0). However I keep getting a type mismatch error when I attempt to make this change, and was wondering if it might be because my Yes/No variable is somehow coded as float rather than string. Could this be the problem? If so, what should I do to fix it? I have included the syntax below which I have tried many times without success.
gen confirmed=0
replace confirmed = 1 if phtn == "Yes"
Thanks!
Kim