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, statalist.org is already up and running.

# Re: st: STATA graph question: Combining Histograms

 From Nick Cox To statalist@hsphsun2.harvard.edu Subject Re: st: STATA graph question: Combining Histograms Date Wed, 17 Aug 2011 20:39:08 +0100

```On second reading: I think by "each question" you mean "every question".

I doubt that you are going to make much progress with -histogram- or
-twoway histogram-, assuming that is what you tried. (Again, you show
no code, contrary to Statalist advice.)

Look at -catplot- (SSC) or -contract- your data to frequencies and use
-graph bar- or -graph hbar-.

Nick

On Wed, Aug 17, 2011 at 8:31 PM, Nick Cox <njcoxstata@gmail.com> wrote:
> We can let -rep78- of the auto data serve as a Likert scale. (The term
> Likert honours Rensis Likert.)
>
> Without code examples of what you tried what you want remains a bit
> vague. Do you want axis scales? labels on the bars? or what?
>
> Is this what you want?
>
> . sysuse auto
> (1978 Automobile Data)
>
> . histogram rep78, freq
>
> . tab rep78
>
>     Repair |
> Record 1978 |      Freq.     Percent        Cum.
> ------------+-----------------------------------
>          1 |          2        2.90        2.90
>          2 |          8       11.59       14.49
>          3 |         30       43.48       57.97
>          4 |         18       26.09       84.06
>          5 |         11       15.94      100.00
> ------------+-----------------------------------
>      Total |         69      100.00
>
> . histogram rep78, freq discrete barw(0.8)  yaxis(1 2) yla(6.9 "10"
> 13.8 "20" 20.7 "30" 27.6 "40" , axis(2)) ytitle("Percent", axis(2))
>
> Here I did it by mental arithmetic after noting that 69 is 100% and 6.9 is 10%.
>
> Nick
>
> On Wed, Aug 17, 2011 at 8:19 PM, Marlis Gonzalez Fernandez
> <mgonzal5@jhmi.edu> 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.
>

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