Announcement

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

  • How to calculate the mean excluding missing observations

    Hi I am trying to calculate summary statistics for several variables excluding missing observations. How do I exclude the missing observations? Here is the code I am using and the dataset is from a household survey. Thanks so much!

    ci means hhsize agehead femhead csize educ_years yearsedu_max youth elderly hhlabour pwd land_owned land_rentin land_rentout land_cultivated land_fallow land_resid land_comm land_ls land_oth gross_income_usd gross_crop_inc_usd gross_live_inc_usd gross_fish_inc_usd ag_wage_usd nonag_wage_usd gross_selfemploy_usd transfer_inc_usd other_inc_usd


  • #2
    It will do so automatically. Can't use . to calculate anything.

    Do you want the sample size for all variables to be same (exclude all missing values for all variables)?

    summ x y if !missing(x,y)

    or

    drop if missing(x,y)

    or

    g missing = missing(x,y)

    which gives you a single variable to "if" on

    summ x y if ~missing


    Comment

    Working...
    X