Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Generating a twoway barplot or histogram

    Hello everyone,

    I have a discrete variable (coffee) [1:5] and I would like to generate a bar plot where for each value of coffee, I have two bars side by side (different colors), one bar for men, one for women.

    I've been trying to find a solution, but couldn't.

    Thanks a lot for your help

    Dusan

  • #2
    One way to do this is with catplot from SSC.

    Code:
    sysuse auto, clear
    ssc inst catplot 
    catplot foreign rep78
    catplot foreign rep78, recast(bar) asyvars

    Comment


    • #3
      Hello,
      Unfortunately I cannot install new packages on my computer (no admin rights to write in c:\ado\plus\c). Would you have a solution with basic Stata13?

      Comment


      • #4
        Code:
        sysuse auto, clear
        gen frequency = 1 
        graph bar (sum) frequency, over(foreign) over(rep78) asyvars ytitle(frequency)

        Comment


        • #5
          Great, it's exactly what I wanted. Thanks

          Cheers

          Comment

          Working...
          X