Statalist


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

Re: st: Treating multiple-variables as one


From   Jeph Herrin <junk@spandrel.net>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Treating multiple-variables as one
Date   Thu, 04 Sep 2008 09:56:18 -0400


There are many different ways to "treat drug1 through drug* as
one measure", the question is what measure you want that to be.

At one point you suggest you are only interested in whether
there is a BP medication, at another you mention a "measure
of total medications". Clarity on this point, and what kind of
rule determines whether drugN (N=1,2,..) is a BP medication
would help.

For instance, if you only want the # of drugs, and each of these
variables drug* is a string, then

 egen numdrugs= rownonmiss(drug*), strok

will generate a variable -numdrugs- which contains the number
of non-missing values among all the -drug*- variables (I've
assumed here that you don't have any variables with the -drug-
stem).

hth,
Jeph

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.

If any one has guidance on this issue, I'd appreciate to hear from you.  Thanks,

Mike Schmitt
michael-schmitt@ouhsc.edu
*
*   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/

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



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