Announcement

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

  • Limit Observation for particular variable

    Is there a way to limit the number of observations for a particular variable? Example if want to run a regression on a variable but wanted to limit the years of experience?

  • #2
    It should be the same as selecting cases. For example, if you wish to keep experience = 10, it'd be:

    Code:
    regress y x if experience == 10
    If there are multiple non-consecutive years (like 1, 5, and 7), it can be:

    Code:
    regress y x if inlist(experience, 1, 5, 7)
    Or if it's a range of experience,like from 5 to 11, then:

    Code:
    regress y x if inrange(experience, 5, 11)
    Jut to be clear: Notice that once a case is not selected due to not fitting the experience requirement, the whole case will not participate in the regression. (Aka, it's not possible to have variables in a regression havive different observation numbers.)

    Comment

    Working...
    X