Announcement

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

  • Bar chart with frequency percentages

    Hello,
    It's been a while since I last used Stata, and now i'm having issues with a basic bar graph

    I have a categorical variable "married" with 0 and 1 ( married and not married ) and I wish to graph a bar chart with percentages for each category.
    I tried using graph bar (percent), over(married) but it's not working, also tried the user interface but couldn't manage to get it.

    Thank you in advance for your help.
    Ash,

  • #2
    You can run the commands here which seem to match yours.


    Code:
    . sysuse auto, clear
    (1978 Automobile Data)
    
    . graph bar (percent) , over(foreign)
    
    . graph bar (percent) , over(foreign) blabel(total)
    
    . tab foreign
    
       Car type |      Freq.     Percent        Cum.
    ------------+-----------------------------------
       Domestic |         52       70.27       70.27
        Foreign |         22       29.73      100.00
    ------------+-----------------------------------
          Total |         74      100.00
    What is "not working" there?

    Comment


    • #3
      Hello Nick,
      Thank you for you fast reply,

      Using the code you provided I get the following error : "(ercent) invalid statistic" , which is the same error I get on my dataset ,
      I think stata doesn't recognize percent

      Note: I have stata 13.0 MP

      Thank you again
      Last edited by Ashtone lazarre; 09 Mar 2021, 10:23.

      Comment


      • #4
        You typed ercent but you need percent.

        Comment

        Working...
        X