Hello everyone
I am trying to define a mata function that will cause Stata to exit a program if the current year is greater than 2016. I have tried the following but have failed, with the error message
nothing found where 'while' expected
r(3000);
. Can somebody make the code work for me.
I am trying to define a mata function that will cause Stata to exit a program if the current year is greater than 2016. I have tried the following but have failed, with the error message
nothing found where 'while' expected
r(3000);
. Can somebody make the code work for me.
Code:
mata
void expired()
{
stata(`"if year(date("$S_DATE", "DMY"))>2016{"')
stata(`"display as error "The Linces has expired, please renew it ""')
stata("exit")
stata("}")
end
}
mata mosave expired()
end

Comment