Hello,
This seems annoyingly simple and I can't believe that Google has failed to help, but it is causing a lot of frustration.
The Stata documentation and many tutorials show how to use arguments in .do files, but it does not appear to work. Even cutting and pasting code from Stata docs. My own testing suggests that arguments are only for .ado files. Is this the case, or am I getting something wrong? As an example, in Stata 13.1 a file called argue.do with this content:
prints a blank line then prints "The arguments are: " before erroring due to insufficient arguments (printf - 3001). Changing to the following:
gives the same result. In contrast, the following argue.ado file works perfectly:
Am I missing something? Are arguments only for .ado files, despite the Stata documentation?
Thanks for any help
Lee.
This seems annoyingly simple and I can't believe that Google has failed to help, but it is causing a lot of frustration.
The Stata documentation and many tutorials show how to use arguments in .do files, but it does not appear to work. Even cutting and pasting code from Stata docs. My own testing suggests that arguments are only for .ado files. Is this the case, or am I getting something wrong? As an example, in Stata 13.1 a file called argue.do with this content:
Code:
capture program drop argue program argue args arg1 display "`arg1'" mata: printf("The arguments are: %s ",`arg1') end argue
Code:
capture program drop argue program argue display "`1'" mata: printf("The arguments are: %s ",`1') end argue
Code:
program argue args arg1 display "`arg1'" mata: printf("The arguments are: %s ",`arg1') end
Thanks for any help
Lee.
Comment