[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Treating multiple-variables as one

From   Svend Juul <[email protected]>
To   <[email protected]>
Subject   Re: st: Treating multiple-variables as one
Date   Thu, 4 Sep 2008 17:15:39 +0200

Mike Schmitt wrote:
I'm a very new Stata user (using Stata/SE 10.1) and I'm currently
running into an issue where I have multiple measures of patient
medications.  Varying patients have varying numbers of drugs and the
current analysis that I am hoping to do would be based on drug class
(i.e., medications for high blood pressure).
The problem is, I have multiple variables accounting for medication
observation (drug1, drug2, drug3, and so on).  So for some patients
drug1 may be their blood pressure medication and for other drug3 may
be their blood pressure medication and if there was only one high
blood pressure drug per person, I could recode into a new variable
without an issue.
My problem is that some patients are on multiple blood pressure
medications.  So even if I want to run a simple command, such as
tabulating frequencies, I don't know how to (or if it is possible) to
treat the drug* variables as one measure of total medications taken by
the patients in the study.
What I am looking to do is have Stata treat drug1 through drug* as one
measure despite the fact that observations were done at the patient
level.  My final hope would to be correlate all the drug observations
with another patient variable (i.e, age) to look at prescribing trends
based on demographic factors.
In the following I assume that you use the ATC codes for the drugs,
and the example allows for up to 5 drugs. To identify patients in
treatment with antihypertensives and with antidiabetics, you can:
    generate antihyp=0
    generate antidiab=0
    foreach D of varlist drug* {
       replace antihyp=1 if (`D' >= "C02" & `D' < "C03")
       replace antidiab=1 if (`D' >= "A10" & `D' < "A11")
        | drug1   drug2   drug3   drug4   drug5   antihyp   antidiab |
     1. | A10BA    C02B    X23C    Y00A    Z11B         1          1 |
     2. |  Z12B    A10B     C02    X45B    Z46C         1          1 |
     3. |   X01                                         0          0 |
Hope this helps
Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6 
DK-8000 Aarhus C,  Denmark 
Phone, work:   +45 8942 6090 
Phone, home:   +45 8693 7796 
Fax:           +45 8613 1580 
E-mail:        [email protected] 

*   For searches and help try:

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