Statalist


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

Re: st: Identify min and max observations


From   Austin Nichols <[email protected]>
To   [email protected]
Subject   Re: st: Identify min and max observations
Date   Sun, 27 Sep 2009 08:31:49 -0400

See
http://www.stata-journal.com/abstracts/pr0004.pdf
and you may eventually want
http://www.stata.com/support/faqs/data/distinct.html
or
http://www.stata.com/support/faqs/data/anyall.html
or
http://www.stata.com/support/faqs/data/members.html
as well.

On Sun, Sep 27, 2009 at 8:17 AM, Thomas Cars <[email protected]> wrote:
> Hi,
> I have a dataset including subjects (id) and date for administration of a
> specific drug (adm.date)
>
> I now want to construct a variable telling me which one of the observations
> (adm.date) in each subject (id) that has the lowest date (min) and the
> highest date(max).
>
> The number of adm.date can vary in each subject from 1 to 10.
>
>
> Example (min=1 och max=2)
>
>
>
> Id                   adm.date        min/max
>
> 1                    12may06         1
> 1                    20jun06
> 1                    30aug06         2
> 2                    10may06         1
> 2                    10sep06
> 2                    20dec06
> 2                    10jan07         2
> 3                    10aug06         1
> 3                    20sep06
> 3                    10dec06
> 3                    15jan07
> 3                    10feb07         2
>
> And so on?
>
> I hope anyone can help me!
>
> Thomas
>
>

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