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: a specific data management question


From   "Michael N. Mitchell" <[email protected]>
To   [email protected]
Subject   Re: st: a specific data management question
Date   Tue, 10 Aug 2010 21:27:22 -0700

How about this...

clear
input firm   tag
       1     0
       1     0
       1     1
       1     1
       1     3
       2     0
       2     1
       2     2
       2     3
       3     0
       3     0
end
egen tag1 = max(tag==1), by(firm)

However, note that this gives a value of 0 if all values of tag are . for a given firm.

Hope this helps,

Michael N. Mitchell
Data Management Using Stata      - http://www.stata.com/bookstore/dmus.html
A Visual Guide to Stata Graphics - http://www.stata.com/bookstore/vgsg.html
Stata tidbit of the week         - http://www.MichaelNormanMitchell.com



On 2010-08-10 8.50 PM, Grace Jessie wrote:
    firm   tag
        1     0
        1     0
        1     1
        1     1
        1     3
        2     0
        2     1
        2     2
        2     3
        3     0
        3     0
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index