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
39 stars 18 forks source link

[iecodebook] - Fix period & label check collision #153

Closed bbdaniels closed 4 years ago

luizaandrade commented 4 years ago

@bbdaniels, feel free to go ahead and merge :)

luizaandrade commented 4 years ago

actually... the labels are not being dropped automatically. neither in this version or the SSC one.

bbdaniels commented 4 years ago

!! This is the main chunk that does it. Thoughts?? It seems to be working in my implementation, I have a dataset that I just handled... can you provide the example that crashes it?

  iecodebook_`subcommand' `anything' using "`using'" , `options'
  iecodebook_labclean // Do this again to clean up after apply or append
  if inlist("`subcommand'","apply","append") qui cap compress // Clean up after apply or append

end

// Label cleaning ------------------------------------------------------------------------------

cap program drop iecodebook_labclean
program iecodebook_labclean

  qui labelbook , problems
  local unused `r(unused)'
  foreach l of local unused {
    la drop `l'
  }

end
luizaandrade commented 4 years ago

I'll send it to you on Slack.