4.1.8 Ranking of table values
It is possible to display only the highest or lowest values in a table, in ascending order. You decide for yourself how many you want to display. This makes it easy to create top 10 lists of municipalities, professions, educations etc.
Tables created using the tabulate
command can be sorted in ascending order by the values in a given column. By default, the column with total values is used if no column is specified. You now also have the option to only display the top or bottom values instead of the entire table. This is an advantage when you have large tables, e.g. displaying municipal values where you have 300-400 rows. You can choose how many you want to display, and for example, create so-called top 10 lists of the units with the highest or lowest values. This is done through the options rowsort
and either top()
or bottom()
as follows:
This can also be done with volume tables, so that you can find, for example, the top 10 municipalities in Vestland ranked by average annual salary:
Note that the values are sorted in ascending order. Therefore, you must run the bottom(10)
option to retrieve the top 10 municipalities, and reverse the list. If you want to find the 10 municipalities with the lowest annual salary, use the top(10)
option.
You can read more about the syntax for rowsort
, top()
, and bottom()
by using the command help tabulate
in the analysis environment at microdata.no.