Good morning Stata forum,
I have a String variable IncidentLocation. I want to use the first word of this string to concatenate it with another string. For example "Clinic (Medical Services Area)" will be "Clinic". the problem is that some string does not have spances between characters. Ex. Bridge/Vestibule will return Bridge/Vestibule and I only need Bridge. How can I add spaces between "/" .
local aword "[^ ]* *"
gen incident= trim(regexs(1)) if regexm(IncidentLocation, "(`aword')")
Thank you,
Marvin
I have a String variable IncidentLocation. I want to use the first word of this string to concatenate it with another string. For example "Clinic (Medical Services Area)" will be "Clinic". the problem is that some string does not have spances between characters. Ex. Bridge/Vestibule will return Bridge/Vestibule and I only need Bridge. How can I add spaces between "/" .
local aword "[^ ]* *"
gen incident= trim(regexs(1)) if regexm(IncidentLocation, "(`aword')")
Thank you,
Marvin