ietoolkit icon indicating copy to clipboard operation
ietoolkit copied to clipboard

iebaltab: suggestion for error message

Open LeonardoViotti opened this issue 6 years ago • 4 comments

When using iebaltab to export to an incorrect folder path (the folder does not exist). The following error occurs:

file C:/.../DataWork/Tables/table.tex could not be opened. r(603);

A more informative error message would be much appreciated.

Thank you!

LeonardoViotti avatar Jan 08 '19 16:01 LeonardoViotti

Sure! That sounds like something we should have! We will include it in the iebaltab re-write.

Thanks @LeonardoViotti!

kbjarkefur avatar Jan 09 '19 00:01 kbjarkefur

@luizaandrade just implemented this in https://github.com/worldbank/iefieldkit/commit/50e3664bbf628f9df1268ca1bbfbf455a3b61c08 for another command – it turns out that Stata is not able to check the existence of folders directly so the error has to be slightly more generic than that but we have the solution on hand.

bbdaniels avatar Jan 09 '19 15:01 bbdaniels

You can do it in one line using Mata. I use this in, for example, ieduplicates:

mata : st_numscalar("r(dirExist)", direxists("`folder'"))
if `r(dirExist)' == 0 {
    //Folder does not exist, do something
}
else {
    //Folder exist, do something else
}

kbjarkefur avatar Jan 09 '19 15:01 kbjarkefur

That's super useful, thanks!

bbdaniels avatar Jan 09 '19 15:01 bbdaniels