Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Ordering a dataset by frequency


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Ordering a dataset by frequency
Date   Mon, 5 Mar 2007 17:47:39 -0000

bysort name : gen negfreq = -_N 
sort negfreq name 

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

jmm50@duke.edu
 
> I have a dataset of 50,000 names.  I need to order them by 
> frequency so 
> that the names that recur the most are at the top of the 
> list, decreasing 
> by frequency.  Thus far I have used bigtab to tabulate the 
> results, but I 
> don't know how to order such a large dataset by freq. , since 
> many commands 
> are refused due to having "too many variables".  The names 
> are listed as 
> string variables.  I used encode name, gen(firstname) to create a new 
> variable with numerical value, but when I use the sort 
> command it sorts it 
> into alphabetical order.  Do you have any idea how I order 
> the data by frequency? 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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