Dear statalist members,
when executing a conditional assert in Stata, if a variable in the condition is not present in the data set, the assert fails with the message "variable not found," followed by error code 111. For a larger project, I need to directly process the name of the missing variable, but I can't find the macro name.
Is it possible that Stata doesn't store this variable name anywhere? Kind regards and thank you in advance, Benno Schönberger
when executing a conditional assert in Stata, if a variable in the condition is not present in the data set, the assert fails with the message "variable not found," followed by error code 111. For a larger project, I need to directly process the name of the missing variable, but I can't find the macro name.
Code:
. sysuse auto
(1978 automobile data)
. assert price < 5000 if missingvariable ==1
missingvariable not found
r(111);
. return list
macros:
r(fn) : "C:\Program Files\Stata19\ado\base/a/auto.dta"
. ereturn list
. sreturn list

Comment