Statalist


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

RE: st: AW: Create a flag variable for 10 most frequent values


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: AW: Create a flag variable for 10 most frequent values
Date   Tue, 17 Nov 2009 11:36:13 -0000

Another bottom line is that nobody seems to be looking around to see whether the problem has been solved already, at least in part. 

-modes- from SJ was updated in 2003: 

SJ-3-2  sg113_1 . . . . . . . . . . . . . . . . . .  Software update for modes
        (help modes if installed) . . . . . . . . . . . . . . . . .  N. J. Cox
        Q2/03   SJ 3(2):211
        provides new option for specifying the number of modes to
        be shown

That doesn't create a flag variable, but it seems a reasonable extra option, so I will add that task to my to-do list. 

Nick 
n.j.cox@durham.ac.uk 

Martin Weiss

Bottom line so far: It takes a bit of ingenuity to do what Elan initially
requested, unless somebody comes along with a neat solution...

Cohen, Elan

>>>> I have a string variable dx that represents a patient's diagnosis
(about
>>>> 5,000 unique values).  I'd like to create a "top 10 flag" that equals 1
>>
>> if
>>>>
>>>> dx is one of the top 10 most frequent diagnoses and 0 otherwise.
>>>>
>>>> I'm not even sure where to begin.  If someone could point me in the
>>>> right
>>>> direction, I'd be grateful.  Stata 10, Windows XP

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index