ietoolkit
ietoolkit copied to clipboard
iebaltab: suggestion for error message
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!
Sure! That sounds like something we should have! We will include it in the iebaltab
re-write.
Thanks @LeonardoViotti!
@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.
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
}
That's super useful, thanks!