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: Pick the first record with a value


From   Lucas Ferreira Mation <lucasmation@gmail.com>
To   statalist <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Pick the first record with a value
Date   Wed, 5 Feb 2014 11:49:55 -0200

I did not understand what you want exactly.
But as long as ndate_added is a numeric variable (formatted as a date)
and not a string variable it should be possible to do sorting or egen.

For example:

egen I=min(ndate_added), by(numserial)

picks the first date of each group of numserial observations.

On Wed, Feb 5, 2014 at 11:40 AM, Keniajin Wambui <kiangati@gmail.com> wrote:
> Dear All;
> nparasit     numserial ndate_added
>                    42231     05-Jun-00
> 7992             42231     03-Jun-00
>                     42242     04-Jun-00
> 144000          42242     05-Jun-00
> 712800           42242     04-Jun-00
> NEG               42242     08-Jun-00
> 371200            42242     06-Jun-00
> 10138              42242     07-Jun-00
>                       110224      21-Dec-11
> 0                    110224     12-Dec-11
>
> I am using Stata 12 on Windows 7 .I have a data set with duplicated
> numserials. I want to pick the first nparasit with a value acording to
> date added (ndate_added). I have tried using sorting but without
> success . How can I go about it
>
> --
> Mega Six Solutions
> Web Designer and Research Consultant
> *
> *   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/
*
*   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