Hi,
I am trying to use "catplot" to plot a survey result about trust on a scale of 1 to 5, where 1 = not trust at all and 5 = fully trust. My data looks like this, where "entity" and "TrustScore" are variable names.
Using the above data, I want to have a figure where each row is about one entity, and the bar shows the relative frequency of each categorical value with a different color. I was able to generate the figure that I wanted using the code below. However, this code now generates an error message "varlist not allowed". I think maybe the syntax for "catplot" changed? I would highly appreciate it if someone can help me.
catplot TrustScore Entity, asyvars stack percent(Entity) var3opts(label(labsize(vsmall))) ytitle(Percent) ///
bar(1, color(blue) fintensity(inten100)) ///
bar(2, color(blue) fintensity(inten40)) ///
bar(3, color(dimgray) fintensity(inten100)) ///
bar(4, color(red) fintensity(inten40)) ///
bar(5, color(red) fintensity(inten100)) ///
legend(size(small)) ///
name(a_expret_fig, replace)
I am trying to use "catplot" to plot a survey result about trust on a scale of 1 to 5, where 1 = not trust at all and 5 = fully trust. My data looks like this, where "entity" and "TrustScore" are variable names.
Entity | TrustScore |
President | 1 |
President | 2 |
President | 3 |
President | 5 |
President | 5 |
Congress | 5 |
Congress | 1 |
Congress | 2 |
Congress | 3 |
Congress | 4 |
Congress | 5 |
Usfirm | 1 |
Usfirm | 1 |
Usfirm | 1 |
Usfirm | 2 |
Usfirm | 2 |
Usfirm | 2 |
Usfirm | 3 |
Usfirm | 3 |
Usfirm | 3 |
Usfirm | 4 |
Usfirm | 4 |
Usfirm | 1 |
Usfirm | 1 |
Usfirm | 1 |
Usfirm | 1 |
catplot TrustScore Entity, asyvars stack percent(Entity) var3opts(label(labsize(vsmall))) ytitle(Percent) ///
bar(1, color(blue) fintensity(inten100)) ///
bar(2, color(blue) fintensity(inten40)) ///
bar(3, color(dimgray) fintensity(inten100)) ///
bar(4, color(red) fintensity(inten40)) ///
bar(5, color(red) fintensity(inten100)) ///
legend(size(small)) ///
name(a_expret_fig, replace)
Comment