Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: From: Qunzi Zhang <zhangqunzi@googlemail.com>


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: From: Qunzi Zhang <zhangqunzi@googlemail.com>
Date   Sun, 4 Nov 2012 19:24:26 +0000

It;'s a very good idea to give a title or subject for your postings.
This point was made, if by example rather by exhortation, in a reply
to your earlier post. See

http://www.stata.com/statalist/archive/2012-11/msg00024.html

I guess nan is implying "not a number", and so a missing value. Some
software documentation uses "NaN", but Stata doesn't use this term.

But whatever it, is the first occurrence of "nan" is just the minimum
over all the first times for which each firm variable takes the value
"nan".

If "nan" does mean missing, and if I understand you correctly, you could go

egen nmissing = rowmiss(firm*)
su date if nmissing > 0

to get the minimum date for the first nan.

Although you were adamant in the earlier thread that you want this
data structure, it only makes problems like this more difficult.

Nick

On Sun, Nov 4, 2012 at 6:17 PM,  <owner-statalist@hsphsun2.harvard.edu> wrote:

> I have a dataset as below
>
> date          firm 1   firm2    firm3 .....(permno as identifer index for firm)
> 1970Jan01   1         2      nan
> 1970Jan02   1         2      nan
> ..........................................
> 1990Jan01   1        2        4
> 1990Jan02   1        2        4
>
> .........................................
> 1990Jan01   1      nan       nan
> 1990Jan02   1      nan       nan
>
>
> I would like to store the time/row index for the first nan value and
> the first non-nan value in this data set. Can anyone give me an
> example about how to do this?
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index