This looks like a problem in the way you're using
the code, and not in my program. If the longest string has
fewer than # characters, then clearly extracting
# dummies will produce at least one that is missing.
The 6 was tailored to your original example.
Nick
[email protected]
Jeffrey Simons
>
> Thanks to both nick and nikos.
>
> Nick's solution works well provided that I have a number
> value that takes
> on 6 digits otherwise it assigns the value for code6 as missing
>
> That is
>
> var1
> 29
>
> Results in
>
> var1 binary code1 code2 code3 code4 code5 code6
> 29 11101 1 1 1 0 1
>
> But
>
> var1
> 29
> 35
>
> Results in
>
> var1 binary code1 code2 code3 code4 code5 code6
> 29 011101 0 1 1 1 0 1
> 35 100011 1 0 0 0 1 1
>
> So , I can just make sure I include a data point that will
> require a 6 digit
> binary code and it will work well.
*
* 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/