Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: need little help


From   Edwin Leuven <[email protected]>
To   [email protected]
Subject   Re: st: need little help
Date   Wed, 23 Apr 2003 13:41:10 +0200

by id, sort: g abmed = ((sum(amed)>0) + (sum(bmed)>0))>1 

On Wed Apr 23 2003 13:20, Giulio Rizzoli wrote:
> I have several records per id: At subsequent times my patient
> have received the medication amed or bmed
> In the last record within id I woul'd like to generate
> a variable abmed wich will be 1 (or some value x) only if the  patient
> has in the prior records experinced the use of both amed and bmed or will
> be 0 otherwise.
>
> id time amed bmed abmed
> 10  81  1	  0     .
> 10  87  0	  1     .
> 10  83  0	  1     1
> 11  70  0	  1     .
> 11  76  0	  1	  .
> 11  84  1	  0     .
> 11  99  1	  0     1
> 12  88  1     0	  .
> 12  98  1	  0     0
>
> thank you
>       Giulio Rizzoli
>
> *
> *   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/

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index