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

Re: st: Sorting/ranking Q from new user

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


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

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

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
When I don't know what I'm doing I'm doing Research!

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index