Announcement

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

  • Rationale behind egen's anymatch() with -if-

    I wonder what's the rationale behind the behaviour of egen's anymatch() and anycount() functions when used together with an -if- statement.

    From the help file:
    Code:
    Values for any observations excluded by either if or in are set to 0 (not missing).
    This seems like a major deviation from Stata's standard way of generating new variables in the presence of an -if- statement. I'm not complaining, as this exception is clearly reported in the help file. I'm just curious.

  • #2
    An advantage of this choice is that statements with the skeleton form

    Code:
    egen wanted = anymatch() 
    can be followed by

    Code:
    ... if wanted
    as an easy idiom.

    Comment


    • #3
      Thank you, Nick.

      Comment

      Working...
      X