Announcement

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

  • Tagging observations ignored in regression

    Hi All,

    Suppose I have data like this:

    --------------------- copy starting from the next line -----------------------
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(y x)
    213  3
     23  4
     32 23
     12 34
    321 43
     21  2
      .  .
      1  3
      3  .
    end
    In the above, if I were to run a regression of y on x, rows 7 and 9 would not be included in the regression as Stata ignores rows when at least one variable has a missing value. The dataset I am working with is quite large. Is there a quick way of tagging which observations have been ignored from the regression? The brute force way would be to tag missing values for all variables, but that can be cumbersome when the design matrix is big.

    Best,
    Chinmay

  • #2
    Code:
     
     generate sample = e(sample)
    Stata/MP 14.1 (64-bit x86-64)
    Revision 19 May 2016
    Win 8.1

    Comment


    • #3
      egen reg_check=rowmiss(varlist)
      gen not_in_reg=1 if reg_check>0
      replace not_in_reg=0 if missing(not_in_reg)

      Comment


      • #4
        Thanks a lot!

        Comment

        Working...
        X