worldbank / iefieldkit

Stata commands designed for Impact Evaluations field work. These are tools that are used during/after a survey in the field for data quality monitoring.
MIT License
38 stars 18 forks source link

`iecodebook`: drop unmentioned variables or throw error when codebook does not match data #243

Closed bbdaniels closed 1 year ago

bbdaniels commented 1 year ago

if you use a codebook that does not match the underlying data, behavior is unexpected. need to evaluate further.

luizaandrade commented 1 year ago

I think I'd prefer this to be a warning instead of an error, although I haven't thought as much about it as I would like. I have quite a few times added more variables to data sets after creating the codebook. And although I think this should be flagged, it will not necessarily have bad consequences for the rest of the workflow.

bbdaniels commented 1 year ago

It is quite easy for the user to fix, the way it's written, since it gives the list of names that are missing. What I do not want to allow is for the user to produce a data set that does not match the codebook. So either they force the codebook to dominate (with drop), or they update the codebook.