Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# st: Combining four variables into one

 From Amal Khanolkar To "statalist@hsphsun2.harvard.edu" Subject st: Combining four variables into one Date Wed, 15 Aug 2012 10:31:18 +0000

```Hi all,

I have the following four variables, where 1 indicates diagnoses for a particular type of hypertension. As I don't have sufficient number of cases when I take into account my covariates, I now need to combine these four variables to create 1 variable; 0=no
diagnoses of hypertension, and 1=diagnoses of any type of hypertension (in any of the four variables). Some subjects might have multiple diagnoses. Is there a better and easier way to do this than using the replace command?

I would also like to create a variation of the combined variable such that each subject is entered only one if she has multiple diagnoses to compare it with the other combined variable, where all multiple diagnoses for a subject are inluded.

tab gestht1

Chronic/ess |

ential |

hypertensio |

n O10-O11 & |

642A-C, H |      Freq.     Percent        Cum.

------------+-----------------------------------

0 |  2,986,530       99.84       99.84

1 |      4,926        0.16      100.00

------------+-----------------------------------

Total |  2,991,456      100.00

. tab gestht2

Gestational |

hypertensio |

n O13 & |

642D, 642X |      Freq.     Percent        Cum.

------------+-----------------------------------

0 |  2,970,036       99.28       99.28

1 |     21,420        0.72      100.00

------------+-----------------------------------

Total |  2,991,456      100.00

. tab gestht3

Preeclampsi |

a or |

eclampsia |

O14, O15 & |

642E-G |      Freq.     Percent        Cum.

------------+-----------------------------------

0 |  2,936,962       98.18       98.18

1 |     54,494        1.82      100.00

------------+-----------------------------------

Total |  2,991,456      100.00

. tab gestht4

Preexisting |

hypertensio |

n with |

preeclampsi |

a O11 & |

642H |      Freq.     Percent        Cum.

------------+-----------------------------------

0 |  2,990,936       99.98       99.98

1 |        520        0.02      100.00

------------+-----------------------------------

Total |  2,991,456      100.00

Thanks!

/Amal.

*
*   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/
```