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
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: Pick the first record with a value
Date
Wed, 5 Feb 2014 14:04:04 +0000
I agree with Lucas. The first date (in Stata that is) is just the
minimum date. See also (despite the title)
FAQ . . . . . . . . . . . . . . . . . . . . . . . Generating the last date
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox
7/11 How can I generate a variable containing the last of
several dates?
http://www.stata.com/support/faqs/data-management/
generating-last-date/
Nick
[email protected]
On 5 February 2014 13:49, Lucas Ferreira Mation <[email protected]> wrote:
> 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 <[email protected]> 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/
*
* 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/