Announcement

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

  • twoway histogram Variable write not found error

    Using https://stats.idre.ucla.edu/stat/data/hsbdemo, clear, I attempted to create an overlaid histogram. The code supplied on the site gave me 2 errors: / / / is not a twoway plot type and ( is not a valid command name. I rewrote the code as follows: twoway histogram write if female ==1, start(30) width(5) color(green) freq || histogram write if female ==0, start(30) width(5) color(yellow) freq and produced a beautiful plot.

    But when I attempted to run the same code w/ my data, . twoway histogram write if UL_Indicator ==1, start(1) width(5) color(green) freq || histogram write if UL_Indicator ==2, start(1) width(5) color(yellow) freq, I got the message: variable write not found.

    I cannot see any difference in the syntax of the code. Why would the word "write" not give an error one time and give an error another time?

    Has anyone experienced this problem previously?


  • #2
    Originally posted by Jerome Anderson View Post
    . . . I got the message: variable write not found.

    I cannot see any difference in the syntax of the code. Why would the word "write" not give an error one time and give an error another time?
    The word is a variable name. You don't show any data, but based upon the content of the error message the reason you get the error is because your dataset doesn't contain any variable named write.

    Comment


    • #3
      I cannot get to the webpage OP linked to, it gives me a "This page no longer exists" error.

      Comment


      • #4
        The link to the oarc website is https://stats.oarc.ucla.edu/stata/fa...wo-histograms/ Note in the code on that page, the word "write" is used as a command, not as a variable name.

        Comment


        • #5
          thank you for the correct url - note, however, that in the code on that page "write" is used as a variable name not as a command; see
          Code:
          help twoway_histogram

          Comment


          • #6
            Thanks, Rich. I didn't notice "write" was in fact a variable name. My mistake.

            Comment

            Working...
            X