Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: first occurrence of the highest value


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: first occurrence of the highest value
Date   Thu, 19 Sep 2013 19:50:21 +0100

The first occurrence of the highest grade is

by ptid: egen first_time = min(time / (wbc_gr == max_wbcgr))

assuming a variable -time-.

Nick
[email protected]

On 19 September 2013 19:38, Marginean, Horia <[email protected]> wrote:

> I am relatively new to Stata and have difficulties solving this problem.
> Below is the status of on ptid that has encountered toxicity grade 1 , 2, 3 -- wbc_gr
> I would like to create a vlb that will identify the first occurrence of the highest value (grade). Vlb max_wbcgr  was created -- bysort ptid: egen max_wbcgr  = max( wbc_gr ) - to identify the highest grade.
>
> As well as a particular case -  to identify the occurrence of a specific grade.
>
> wbc_gr   max_wbcgr
> -------------------
>  1          3
>  2          3
>  2          3
>  3          3
>  3          3
>   .          3
>   .          3
>   .          3
>   .          3
>   .          3
> +-------------------+
>
> Many thanks in advance for your help!
> I am using Stata version 12.1 windows XP
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index