worldbank/iefieldkit

iecorrect: command breaks if ID with correction in `apply` contains `-`

kbjarkefur opened this issue · 0 comments

It is not possible to use iecorrect apply if the ID used in the excel sheet contains hyphens -.

Here is a reproducible example:

sysuse auto, clear
replace make = subinstr(make, "Datsun ", "datsun-",  .)
iecorrect apply using "C:\Users\wb462869\Downloads\hyphen-id.xlsx" , idvar(make)

and use the file hyphen-id.xlsx from here: hyphen-id.xlsx.

I get an error that seems to be from the if-condition generated in the program _idcond and used in _donumeric on this line:

local line = substr(`"`line'"', 1, length(`"`line'"') - 3)

It seems like the line brakes on the hyphen in (make == "datsun-210") & "' such that it is trying to run a line of code that is 210") & "'.