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

[iecorrect]: [drop] functionality handles wildcards and [n_obs] incorrectly #228

Closed bbdaniels closed 2 years ago

bbdaniels commented 2 years ago

Using the following sheet, the command neither respects the intended total number of observations to drop, nor does it correctly implement the logic in the second row (zero observations should be dropped).

make foreign n_obs initials notes
* 1 22    
Test 0 0    
iecorrect apply using "/users/bbdaniels/desktop/correct.xlsx" , idvar(make foreign)  noi
    No corrections of type numeric.
    No corrections of type string.
    Number of observations to be dropped: 22

** Drop observations 
drop if (foreign == 1)
(22 observations deleted)
drop if (foreign == 0)
(52 observations deleted)

Corresponding correction required at the helpfile below, including indicating whether n_obs is required or not (and whether or not it is required to be accurate -- I would make this check the default, but skippable by entering wildcard * in the cell): https://github.com/worldbank/iefieldkit/blob/9d67bbb224c14bc1ab37a996f3cd0469468d49e6/src/help_files/iecorrect.sthlp#L154-L159

bbdaniels commented 2 years ago

@luizaandrade I just wanted to confirm that we are NOT allowing wildcards in the n_obs column here. Otherwise it now works correctly.

luizaandrade commented 2 years ago

that is correct. this is now also being tested in f2c851f