# Re: st: RE: convert decimal number in binary format

 From Jean-Benoit Hardouin To statalist@hsphsun2.harvard.edu Subject Re: st: RE: convert decimal number in binary format Date Sat, 05 Dec 2009 22:17:36 +0100

```Thank you,
This is exactly what I searched !
Best
Jean-Benoit

Austin Nichols a écrit :
```
```Maybe this helps?
http://www.stata.com/statalist/archive/2009-10/msg00203.html

On Sat, Dec 5, 2009 at 11:59 AM, Austin Nichols <austinnichols@gmail.com> wrote:
```
```What is the purpose of this whole exercise?  I cannot tell from:
... convert a decimal number into binary variables (patterns represent
the number from 0 to 7 in binary format)
...I want to create a program where the number of variables is not
fixed and can be large

If you tell us what the ultimate goal is, you may get better advice.

On Sat, Dec 5, 2009 at 9:54 AM, Martin Weiss <martin.weiss1@gmx.de> wrote:
```
```<>

Sounds like -egen, group()-...

HTH
Martin

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Jean-Benoit
Hardouin
Sent: Samstag, 5. Dezember 2009 13:45
To: statalist@hsphsun2.harvard.edu
Subject: st: convert decimal number in binary format

Dear all,
I search an idea to create variables which represents all the possible
pattern of responses to a set of binary variables, for example with 3
variables :

var1 var2 var3
0    0    0
0    0    1
0    1    0
0    1    1
1    0    0
1    0    1
1    1    0
1    1    1

I have searched a command to convert a decimal number in binary format (here
the responses patterns represents the number from 0 to 7 in binary format)
but I have not find any such command.

I have no simple idea to create such variables (I want to create a programme
where the number of variables is not fixed and can be large).

Has someone an idea to help me ?
Best,
Jean-Benoit

```
```
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

```
```

--

Jean-Benoit Hardouin, PhD
Maitre de Conférences - Assistant Professor
EA 4275 "Biostatistics, Clinical Research and Subjective Measures in Health Sciences"
http://www.sante.univ-nantes.fr/biostat/

Departement of Biomathematics and Biostatistics
Faculty of Pharmaceutical Sciences
University of Nantes
```
1, rue Gaston Veil - BP 53508 44035 Nantes Cedex 1 - FRANCE Email : jean-benoit.hardouin@univ-nantes.fr Personal website : http://www.anaqol.org
```

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```