Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 73176

Change order of bars using catplot

$
0
0
I have a dataset where the unit of observations is individuals (ISSP Environment IV). I would like to make a graph of the distribution of answers to a likert-scale question (variable 'v17', which has four levels (1-4)) by country. Drawing on a post by Nick Cox, I have written the following code:

catplot, over(v17) over(country) percent(country) asyvars stack

This works well, see attached picture. However, I would like to change the order of the bars. Specifically, they should be ordered by the mean value of v17. With the bar command, that would be achieved with sort(v17), but this option seems not supported by catplot. Is there a way to change the order with catplot? Alternatively, is there another way of creating this kind of graph with another command? It seems like a rather common way to display survey data with categorical values.
Array

Viewing all articles
Browse latest Browse all 73176

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>