Announcement

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

  • How to read figure programming

    Dear All,

    Thank you sincerely for help me and I am encountering the following programming about figures.

    sysuse nlsw88.dta, clear
    tabulate industry
    graph hbar(count) idcode, over(industry)
    blabel(bar, position(outside) format(%3.1f)
    color(blue) size(small))

    I cannot understand what does the underlined mean? what is count? idcode? why we cannot use graph bar to replace graph hbar?

    Best Regards,

    Eddie

  • #2
    Dear All,

    When I am running this program, stata says:



    . graph hbar (count) idcode, over(industry)///
    option / not allowed
    r(198);

    end of do-file

    r(198);

    Best,

    Eddie

    Comment


    • #3
      stata also shows that:

      hbar(count)graph_g invalid name
      r(198);

      end of do-file

      r(198);

      Comment


      • #4
        - idcode is the name of the variable you are trying to graph.
        - (count) asks Stata to graph the number of instances each idcode appears in the dataset. The default is that Stata would graph the mean value of idcode (try your self by removing the (count) bit
        - you can use graph bar for this, although the readibility is not improved.
        - the /// is a line continuation marker. It is important to include a space before the marker.
        - the use of /// is for code written to be used in the do file editor (CRTL+9 to open a new window).
        - In response to #3: note the space between hbar and (count)

        If, in the do file editor, you run:
        Code:
        sysuse nlsw88.dta, clear
        tabulate industry
        graph hbar (count) idcode, over(industry) ///
        blabel(bar, position(outside) format(%3.1f) ///
        color(blue) size(small))
        This is equivalent to running individual commands in the command box as:
        Code:
        sysuse nlsw88.dta, clear
        tabulate industry
        graph hbar (count) idcode, over(industry) blabel(bar, position(outside) format(%3.1f) color(blue) size(small))
        So the /// instructs Stata to read it all as one line, but makes it easier to read for th person using the code

        Comment


        • #5
          If we type in the command window

          Code:
          help graph bar
          We find several examples and an abridged information about the commands.

          Also, there is a whole (free) manual about graphics which I strongly recommend to take a look: Stata Graphics Reference Manual.

          You may also thumb through the examples of graphics you feel more interested in.
          Best regards,

          Marcos

          Comment


          • #6
            Thank you sincerely Jorrit and Marcos.

            Comment

            Working...
            X