syntax command syntax issue

I’ve spent hours reading Stata help file (17SE) but I’m unable to understand why the syntax in this syntax command is wrong:

syntax, n(integer) interact(real) infage(integer min=45 max=75) supage(integer min=45 max=75)

For sure the part until interact(real) works, but what’s wrong with the following part?

>Solution :

I suspect that you want something more like

syntax, n(integer) interact(real) infage(numlist integer >=45 <=75) ///
supage(numlist integer >=45 <=75)

There are two points here.

The min and max arguments are about how many elements are specified, not about what their values might be. I doubt that you want to insist that the user types in at least 45 integers to each option.

Expecting that a specification integer() would support specification of the allowed range seems reasonable enough, but nothing in the documentation supports that. It’s numlist() that allows more checking.

Leave a Reply