Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

Re: st: STATA graph question: Combining Histograms

From   Svend Juul <>
To   "" <>
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:

   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 Juul
+45 2634 7796<>

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index