Sorry about the mangled script in the previous.
Code:
log using choonjo_problems.log
set more off
display "Stata " c(stata_version)
foreach cmd in findname missings {
which `cmd'
}
* 2. missings breakdown: error r(3000) when missing values occur only in strings.
* Numeric variables can be present, provided none of them has a missing value.
clear
input byte id str1 s
1 "a"
2 ""
end
capture noisily missings breakdown
local bd_rc = _rc
display "missings breakdown: rc=`bd_rc'"
assert `bd_rc' == 3000
* capture noisily displays the expected error and lets the remaining examples run.
* In actual checks, do not ignore an error and interpret it as "no missing values".
* 3. Recommended: findname for a variable list; missings report for counts.
* missing() detects numeric . and .a-.z, and the empty string "".
findname _all, any(missing(@))
local mvars "`r(varlist)'"
display "Variables with missing values: `mvars'"
assert "`mvars'" == "s"
missings report
assert "`r(varlist)'" == "s"
log close

Comment