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]

Re: st: STATA graph question: Combining Histograms


From   Svend Juul <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: STATA graph question: Combining Histograms
Date   Thu, 18 Aug 2011 20:07:22 +0200

Marlis wrote:

I am trying to combine frequency histograms for several questions
into one graph.  Each variable has the answers to questions in a
likert scale (always, frequently, infrequently, never, don't know).
I want to plot the frequency and percent for each question side by
side.  Have not found a good way to do this.

**********************************************************

With Likert-type questions, stacked bars communicate efficiently.
Recycling part of Nick's suggestion:

   clear
   set obs 100
   forval i = 1/10 {
         gen answ`i' = ceil(5 * runiform())
   }
   gen id  = _n
   reshape long answ , i(id) j(ques)

   gen x=1
   graph bar (count) x ,           ///
      over(answ) over(ques) asyvars percent stack ///
      bar(1, fcolor(gs0)) ///
      bar(2, fcolor(gs6)) ///
      bar(3, fcolor(gs10)) ///
      bar(4, fcolor(gs13)) ///
      bar(5, fcolor(gs16)) ///
      legend(pos(4) order(5 "strongly disagree" 4 "disagree" ///
         3 "neither-nor" 2 "agree" 1 "strongly agree"))

Hope this helps
Svend
_______________________
Svend Juul
+45 2634 7796
[email protected]<mailto:[email protected]>


*
*   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