Announcement

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

  • Graph bar question

    I'm working with a large household dataset and putting together simple graphics. I'm trying to create a bar graph which corresponds to a question "How many days of school were missed in the past 4 weeks", and then have the graph appear by assignment (control, treatment light, treatment classic). My code is:

    graph bar (asis) q_sch_11 if q_sch_11!=99, by(assignment, title(Total Number of Years of Schooling Completed) rows(1))

    and the error I receive is "_merge already defined".

    Any help would be much appreciated.

  • #2
    To circumvent the problem you could try:

    preserve
    drop _merge
    graph bar (asis) q_sch_11 if q_sch_11!=99, by(assignment, title(Total Number of Years of Schooling Completed) rows(1))
    restore

    -Nick

    Last edited by Nicholas Otis; 20 Oct 2014, 12:09.

    Comment


    • #3
      When I tried that I got:

      variable _variables does not uniquely identify the observations

      Comment


      • #4
        Also, somewhat related question: do you know how to drop the "mean of q_sch_11" yaxis label in code? I can only get it deleted in the graph editor

        Comment


        • #5
          Usually such a label only appears because you are asking for a plot of means, which is the default for graph bar.

          Your previous question may still be open. If you are expecting graph bar to count days for you, that won't work.

          Please note our request for full real names as identifiers: "exitmusic" doesn't qualify, See FAQ Advice Section 6.

          Comment


          • #6
            I think it is (asis) that bites you. It is for the case where you have tabular data with one observation per bar to be drawn, at that is probably not what you have. This command gives the same error message as in post # 3:

            Code:
            sysuse auto
            graph bar (asis) mpg

            Comment


            • #7
              Thanks all. Nick, I'm new to to forum and apologize for the name oversight. I've sent in my request for a username change.

              Comment

              Working...
              X