This is good advice, but doesn't help in this problem.
Stata's built-in definition of words can't be squared
with the string and substring notation used in Radu's
data. See my previous posting for a suggested solution.
Nick
[email protected]
Ada Ma
> you should be able to find out more about these commands if you look
> it up on -help string functions-:
>
> * first count the number of strings in your string variable
> gen wordcount=wordcount(mystring)
>
> tab wordcount
>
> gen split1=word(mystring,1)
> ...
>
> so on and so forth.
Radu Ban
> > I have a string variable that looks like this:
> >
> > mystring
> > (1 2 3) (1 2 2) (7 8 9) (1 3 4)
> > (2 3 4) (1 2 3) (10 11 12)
> >
> > etc. The numbers inside the brackets are made up. The
> problem is that
> > the number of spaces between brackets is not constant. Also
> the number
> > of brackets is not constant across observations. I want to
> split this
> > variable so that each bracket is contained in its own variable, i.e.
> >
> > split1 split2 split3 split4
> > (1 2 3) (1 2 2) (7 8 9) (1 3 4)
> > (2 3 4) (1 2 3) (10 11 12) <blank>
> >
> > I've tried the -split- command, with various numbers of
> spaces as the
> > parse character, but that doesn't work, i.e. it doesn't split if i
> > specify too many blanks, or it creates blank observations
> if i specify
> > too few blanks.
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/