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

#1
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

etc.

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!
 

Dason

Ambassador to the humans
#3
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.

http://www.stata.com/help.cgi?split

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