Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Sorting/ranking Q from new user


From   JAYESH KUMAR <[email protected]>
To   <[email protected]>
Subject   Re: st: Sorting/ranking Q from new user
Date   Fri, 1 Aug 2003 10:31:13 +0530 (IST)

Hi!

For sorting in assending or descending order you can use "gsort" with "-" option.

*for example:
sort year in desending order
gsort - year

*This will create percentiles, you can choose your own number of groups.
*for ranking purpose:
by year:gen a=_n
bysort year: egen b=max(a)
gen percentile_year=((a/b)*100)

*for reporting summary statistics:
bysort percentile_year: summarize year

HTH,
-Jayesh Kumar

#You wrote:
:(a) sort in ascending or descending order;
:(b) rank the sorted X into some specified number of groups;
:(c) report the mean of X (or some other statistic) by group.

************************************************************************
JAYESH KUMAR,
Research Scholar,
Indira Gandhi Institute Of Development Research (IGIDR),
Gen. Arun Kumar Vaidya Marg,
Santosh Nagar, Goregaon (East), Mumbai-400065, INDIA.
Tel # + 91 (22) 2840 0919/0920/0921  Extn. 591(Office) 263(Residence)
Fax # + 91 (22) 2840 2752/2026
visit: www.igidr.ac.in/~jayesh
************************************************************************
When I don't know what I'm doing I'm doing Research!

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