Cookies

We use cookies to ensure that we give you the best experience on our website. By continuing to browse this repository, you give consent for essential cookies to be used. You can read more about our Privacy and Cookie Policy.


Durham Research Online
You are in:

Speaking Stata: Ordering or ranking groups of observations

Cox, Nicholas J. (2021) 'Speaking Stata: Ordering or ranking groups of observations.', The Stata Journal: Promoting communications on statistics and Stata, 21 (3). 818 - 837.

Abstract

Results for categorical variables may often be clearer if those variables are reordered or reranked, say, according to some measure of absolute or relative frequency or according to summaries of some other variable. Some graphical and tabulation commands have dedicated options serving that end. Otherwise, in practice a new order is often best achieved by creating a new variable holding the desired order using one or another egen function. There is usually a need to preserve the information in existing values or value labels and to watch out for ties. There may be a desire to reverse the direction of ranking from the default. I discuss procedures for datasets based on aggregate frequencies and for datasets based on individuals and introduce a new convenience command, myaxis, that handles many cases directly.

Item Type:Article
Full text:(VoR) Version of Record
Available under License - Creative Commons Attribution 4.0.
Download PDF (Advance online version)
(383Kb)
Status:Peer-reviewed
Publisher Web site:https://doi.org/10.1177/1536867X211045582
Publisher statement:This article is distributed under the terms of the Creative Commons Attribution 4.0 License (https://creativecommons.org/licenses/by/4.0/) which permits any use, reproduction and distribution of the work without further permission provided the original work is attributed as specified on the SAGE and Open Access pages.
Date accepted:No date available
Date deposited:20 January 2022
Date of first online publication:04 October 2021
Date first made open access:20 January 2022

Save or Share this output

Export:
Export
Look up in GoogleScholar