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: "table" showing summary of ~100 ternary variables?


From   Phil Schumm <[email protected]>
To   [email protected]
Subject   Re: st: "table" showing summary of ~100 ternary variables?
Date   Sat, 30 Oct 2010 16:21:50 -0500

On Oct 30, 2010, at 3:13 PM, Phil Schumm wrote:
Now, we'll compute the proportion correct (as a proportion of values 1-3) for each variable:


   egen correct = max((y==1)*cnt), by(Var)
   egen nonmiss = sum(inlist(y,1,2,3)*cnt), by(Var)
   bys Var (y): replace cnt = correct[1] / nonmiss[1] if y == 5


Note for the record that the third line above may be replaced with the simpler


    replace cnt = correct / nonmiss if y == 5


(the original was left over from an initial approach which I then simplified).


-- Phil

*
*   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