st: translation between binary system and the decimal system.

I’ve got data that is binary coded. That is, an observation may belong
to category 1, 2, 3 , 4 or a combination amongst these categories. My
variable cat_id has the value of 1 1f it is in category 1; 2 if it is in
category 2; 4 if it is in category 3; and 8 if it is in category 4. My
variable has the sum of these values, i.e. cat_id=9 means that my
observation is in category 1 and 4.

I would like to generate 4 dummies for a new category identification.

cat_id

Cat4

Cat3

Cat2

Cat1

1

0

0

0

1

2

0

0

1

0

3

0

0

1

1

4

0

1

0

0

5

0

1

0

1

…

10

1

0

1

1

i.e. it is a simple translation between binary system and the decimal
system.