I wrote in response to Tom Steichen
> > Something of the form
> >
> > . for any A B C D E F G H I: gen v_X=index(var, "X") \ replace
> > v_X=1 if v_X>1
> >
> > where A B C D E F G H I is the list of possible alpha characters
> > and var is the variable of interest
> >
> > will generate individual numeric (0,1) variables for each alpha code
> > that can then be tabulated with the usual tabulation commands.
> >
> > Tom
> >
>
> There's a small slip in Tom's code here.
>
> He meant
>
> . for any A B C D E F G H I: gen v_X=index(var, "X") \ replace
> v_X=1 if v_X>0
>
> because otherwise all occurrences in the first column will
> be ignored.
Actually, _this_ slip is all mine, as if -v_X- is already
1 then the -replace- is redundant, as Tom clearly saw.
Apologies to him.
The rest of my posting still holds, I believe.
Nick
n.j.cox@durham.ac.uk
*
* 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/