Hello,
I am trying to identify for the variable "agency" (a string variable) these observations that contain either "state" or "district". Based on what I read, I used :
gen new_variable = regexs(0) if(regexm(agency, "(state | district)"))
But I think it only identifies the observations that contain "state". I tried a few variations but did not work. Can you advise what is the right code for this. Thank you very much.
I am trying to identify for the variable "agency" (a string variable) these observations that contain either "state" or "district". Based on what I read, I used :
gen new_variable = regexs(0) if(regexm(agency, "(state | district)"))
But I think it only identifies the observations that contain "state". I tried a few variations but did not work. Can you advise what is the right code for this. Thank you very much.
Comment