Announcement

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

  • How to bound x-axis on histogram

    I'm using the command

    histogram [cat var]

    to output a histogram in stata. I only care about the values of the categorical variable which are greater than 0, but there are some negative values and they also show up in the histogram. I understand that I could drop those values and then generate the histogram again (and I have done that and seen it work), but I am wondering if I could restrict the histogram to when the values are greater than 0 during its generation.

  • #2
    What you want is an if qualifier, specifying the condition you want to be true. Something like

    Code:
    hist y if y>0
    That said, you say you have negative values, so you should really try to understand why that is, and why you only want the positive values.

    Comment


    • #3
      Got it, thanks!

      Comment

      Working...
      X