Hi,
I have a large dataset with 39,764 observations of which many have repeating values. The variable kommune_karaktergennemsnit (the school grade average of a municipality) has 22 unique values. The variable kommune_id (the name of the municipality) has 96 unique values. How do I list the top (and bottom) 5 (n) unique values of kommune_karaktergennemsnit – ideally with the corresponding values of kommune_id:
Thanks!
I have a large dataset with 39,764 observations of which many have repeating values. The variable kommune_karaktergennemsnit (the school grade average of a municipality) has 22 unique values. The variable kommune_id (the name of the municipality) has 96 unique values. How do I list the top (and bottom) 5 (n) unique values of kommune_karaktergennemsnit – ideally with the corresponding values of kommune_id:
kommune_id | kommune_karaktergennemsnit |
1. Lyngby-Taarbæk | 8.6 |
2. Hørsholm | 8.5 |
3. Gentofte | 8.3 |
4. Rudersdal | 8.1 |
5. Allerød | 8.0 |
Thanks!
Code:
* Example generated by -dataex-. For more info, type help dataex clear input long(elev_id kommune_id) double(elev_karaktergennemsnit kommune_karaktergennemsnit) 20912 56 8.8 8.6 20978 56 8.1 8.6 20997 56 9.4 8.6 21023 56 6.9 8.6 21004 56 9.4 8.6 21098 56 9.3 8.6 20692 56 10 8.6 20736 56 7.9 8.6 20932 56 7.9 8.6 20776 56 10 8.6 20714 56 8.8 8.6 20961 56 8.1 8.6 21120 56 9.3 8.6 20833 56 8.7 8.6 20765 56 10 8.6 20979 56 8.1 8.6 21052 56 7.1 8.6 21102 56 9.3 8.6 20664 56 10 8.6 21080 56 9.3 8.6 end label values kommune_id kommune_n label def kommune_n 56 "Lyngby-Taarbæk", modify
Comment