help wfex_miss: Working with missing values

List of examples

1. Create indicator of cases without missing values in a set of variables.
2. Select cases if specific variables are missing or not missing.
3. Create indicator if any of a set of variables are missing.
4. Summarize missing data in a dataset.

1. Create indicator of cases without missing values in a set of variables

* create variable notmissing to indicate no missing values for a set of variables
mark notmissing
label var notmissing "No missing in <set-of-variables>?"

* notmissing is 1 if no missing in <set-of-variables>
markout notmissing <set-of-variables>

* label values
label def notmissing 0 0_missing 1 1_nomiss
label val notmissing notmissing
tab notmissing, missing

* keep cases where no missing on <set-of-variables>
keep if notmissing

2. Select cases if specific variables are missing or not missing

Note: Add your variable name for <var1> and <var2>

2a. Select cases with missing values for <var1>

keep if missing(<var1>)

2b. Select cases that do not have missing values for <var1>

keep if !missing(<var1>)

2c. Select cases that do not have missing values for <var1> or <var2>

keep if !missing(<var1>) & !missing(<var2>)

3. Create indiator if any of a set of variables are missing

gen ismiss = miss(<var1>,<var2>,<var3>,...<varK>)
label var ismiss: Are any of <var1> to <varK> missing?
label def ismiss 0 0_nomiss 1 1_somemiss
label val ismiss ismiss

4. Summarize missing data in dataset

misschk

For details, help misschk. misshck is part of the SPOST package.

Also see

Chapter _ of the Workflow book; misschk; mark; Workflow