Statalist


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

Re: st: Chosing minimum value out of 6 variables


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Chosing minimum value out of 6 variables
Date   Mon, 26 May 2008 16:07:16 +0100 (BST)

--- Ziad El-Khatib <Ziad.El-Khatib@ki.se> wrote:
> I have adherence level for 6 different drugs (drug1, drug2, etc..),
> inside cohort datafile, followed over 12 months.
> At every visit there are data for 3 out of 6 drugs and I want to have
> new variable having the minimal value for drug adherence

*---------------- begin example -----------------
clear
input id visit drug1 drug2 drug3 drug4 drug5 drug6 
      1  2     10    20    30    .     .     .     
      2  2     40    30    .     50    .     .
end
egen minval = rowmin(drug*)
*----------------- end example -------------------
(For more on how to use examples I sent to the Statalist, see
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )

Hope this helps,
Maarten


-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      __________________________________________________________
Sent from Yahoo! Mail.
A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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