Bert Jung wrote:
Many thanks Gary. Is there any way to restrict the `options' macro to
contain only elements allowed by -graph-? My worry is that the
wildcard [ * ] would collect any user input and could generate an
error message at the end of the program.
Bert,
Not that I am aware of, at least not at the level of the syntax command.
But the only user input that will be collected in `options' is that not allowed
by your syntax statement otherwise. If user input isn't explicitly allowed by
the -syntax- command or doesn't consist of valid twoway options allowed by the
internal graph command, then it seems to follow that your program *should*
return an error.
So the question isn't whether the disallowed user input will return an error.
It will and should return an error whether [*] is included or not. Including
[*], in addition to allowing the inclusion of -twoway options-, only delays the
disallowed syntax error until the -twoway- command is called. The error
returned by the internal graph command resulting from disallowed arguments
passed via `options' will be a meaningful one - it should identify the first
disallowed argument in the list - and should be similar to that which would
otherwise be returned by the initial syntax command in -mygraph- if [*] were not
included.
If writing the program for other users, you are likely to include a help file
which will specify the allowed options for -mygraph-, including an entry
indicating that generic twoway_options are allowed. Eg. The help file line from
-histogram-, an official Stata ado also which uses [*] to capture and pass along
graph command options reads:
. . .
options
. . .
twoway_options any options documented in [G] twoway_options
. . .
So users will know that not just "any input" is allowed, but that any of the
standard -twoway options- are permitted.
- Gary
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/