Announcement

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

  • Histogram command but want to use values greater than 0 but less than 80 from a dataset?

    What is the stata histogram command for when we want to make a histogram of a dataset, but want to use values greater than 0 but less than 80?

    I know it is "histogram (dataset)", but how do I make sure the values being used are between 0 and 80?

    I thought I got somewhere, but ended up getting an error of "varlist required." Sorry for this simple question I am completely new!

  • #2
    I know it is "histogram (dataset)"
    No, it is not, and whatever source you got that information from is unreliable.

    The syntax of the histogram command requires you to give the name of the variable you want to make a histogram of. If you want to restrict the values to the range of 0 through 80, you can do that by adding an -if- condition to it. So if the variable you want to make a histogram of is called x, then the command would be:
    Code:
    histogram x if inrange(x, 0, 80)

    Comment

    Working...
    X