Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Showing all categories in legend with catplot


From   "Martin Lee" <[email protected]>
To   <[email protected]>
Subject   st: Showing all categories in legend with catplot
Date   Thu, 21 Jul 2011 12:40:48 +1200

Hi

I'm having some problems with getting catplot to display all the
categories in the legend for some questionnaire data where not all of
the Likert scale response range is recorded for some of the questions. 

Example data and catplot command is below (q1 = question 1, q2 =
question 2, newold = clinic type)

clear

inp byte(q1 q2 newold)
1 2 1
1 1 1
1 2 1
2 1 1
2 2 1
2 1 1
3 2 1
1 1 2
1 2 2
2 2 2
3 1 2
3 2 2
end

lab def qlab 1 "Agree" 2 "Neutral" 3 "Disagree"
lab val q1 q2 qlab

lab def nlab 1 "New" 2 "Old"
lab val newold nlab

catplot q1 , over(newold) stack asyvars perc(newold) caption("Q1")
name(g1, replace)
catplot q2 , over(newold) stack asyvars perc(newold) caption("Q2")
name(g2, replace)

And as you will see, for Q2, the legend only shows the "Agree" and
"Neutral" responses.

How do I get all the categories to display?

Thanks in anticipation

Martin

Dr Martin Lee
Public Health Dentist
Clinical Director
Community Dental Service



*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index