Separate x;y;z in a variable to three variables

Hi all,

I am doing a medical study and I have a variable called complications. One patient can have more than one complication and the variable complication for each patient looks like this:

id 1 complication x;y;z
id 2 complication m;n;o


where m-z are different numbers
for example 1=infection 2=wound etc

I would like to have a separate variable for each complication, so that if a patient has 1;3;5 this patient will have

infection = 1

and so on.

Which is the best and fastest way to do this in Stata?

Thank you!


Ambassador to the humans
Boo. I don't like excel so even though I don't use STATA I tried to see what I could do. In R I would something like 'strsplit' so I searched for something similar.

Looks like split will break the string up for you then you'll need to do a little programming to process that.