Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Decimal to binary


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Decimal to binary
Date   Wed, 10 Mar 2004 17:36:50 -0000

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index