Hi everyone,
I have a variable in my STATA dataset which (often) has numerous numbers separated by both semicolons and commas. For example, one observation for this variable might read 14,15,17;2;9;12. I would like to separate these numbers out into a new variable, and I think a sensible first step would be to change the semicolons to commas (or vice versa) before doing so, because if I simply split variable, p(",") or split variable, p(";"), the numbers don't split correctly if there is a number between a semicolon and comma. Does anyone know how to do this or have a workaround to my problem?
Warm regards, Oliver
I have a variable in my STATA dataset which (often) has numerous numbers separated by both semicolons and commas. For example, one observation for this variable might read 14,15,17;2;9;12. I would like to separate these numbers out into a new variable, and I think a sensible first step would be to change the semicolons to commas (or vice versa) before doing so, because if I simply split variable, p(",") or split variable, p(";"), the numbers don't split correctly if there is a number between a semicolon and comma. Does anyone know how to do this or have a workaround to my problem?
Warm regards, Oliver
Comment