Closed arthur-shaw closed 10 months ago
A crude sketch for variables with(out) a variable label:
capture drop lbl_has_var_label
program define lbl_has_var_label, rclass
qui {
syntax varname, negate
if (!mi("`negate'") {
ds `varname', has(varlabel)
local local varlist = r(varlist)
}
else {
ds `varname', not(varlabel)
local local varlist = r(varlist)
}
}
Problem
In disseminated data, all variables should have variable labels. Yet variable labels may be missing for several reasons. First, some variables might be exported without a label (e.g., multi-select linked questions). Second, some data cleaning operations might (accidentally) remove labels.
To identify such cases and to ensure that no such cases remain after data work, commands are needed to:
Ideas for implementation
This might be as simple as writing a wrapper for
ds, not(varlabel)
.