Dear All!
How do I specify a missing value as the default value for an optional numeric option in the syntax declaration?
For example, consider the following code:
I don't see a reason why a missing value may not be declared as a default value. I understand that the behavior corresponds to the documentation as outlined in the section "option descriptor optional real value" of the help to syntax. But I don't understand why this behavior was chosen, not permitting numeric defaults. (Same applies to .a, .b, ..., .z - all missing values).
Either code works if the missing value is passed as the option's value:
So, is there a more comfortable implementation of listsome avoiding a special value like is shown in listsome2?
Thank you, Sergiy
How do I specify a missing value as the default value for an optional numeric option in the syntax declaration?
For example, consider the following code:
Code:
clear all program define listsome version 16.0 syntax varname, [maxval(real .)] list `varlist' if `varlist'<`maxval' end program define listsome2 version 16.0 syntax varname, [maxval(real -999999)] if (`maxval'==-999999) local maxval=. list `varlist' if `varlist'<`maxval' end sysuse auto listsome2 price // works, but clumsy implementation listsome price // doesn't work => Error 197: Invalid syntax // end of file
Either code works if the missing value is passed as the option's value:
Code:
listsome price, maxval(.)
listsome2 price, maxval(.)
Thank you, Sergiy
Comment