Martin, you can use the maintanence files mentioned earlier.
E.g. here is an extract from ....\Stata10\ado\updates\r\rhelp_alias.maint:
reg regress
...... skipped ........................................................
regr regress
regre regress
regres regress
Note that reg.ado exists but calls regress, which in turn calls _regress.
So you have a chain like this (example):
alph--> alpha-->alpha_hidden
(here alph is an alias, which in fact calls alpha which is implemented
in alpha_hidden) and your program has to decide where to stop.
Maintanence files seem to eliminate this problem providing you
directly with the name of the command. All you have to do is check
that the corresponding word is recognized by Stata as a statement.
-which- will help you with that.
Use -unab- to expand variable names. But this can be difficult in
cases when a command is issued when those variables are _not there
yet_, as in :
clear
use p using ".\ado\base/a/auto.dta"
since variable is not there yet, we don't know what it expands to. If
you do expansion after the command then the problem would be e.g. in
-drop-, since the variable may not exist _any longer_.
Best regards,
Sergiy Radyakin
On Mon, Sep 22, 2008 at 3:05 PM, Martin Weiss <[email protected]> wrote:
> Last night I was wondering whether I could write a small -program- that
> would let me run abbreviated code through Stata, such as the now
> immortalized -prob f p w- and have Stata create a log or screen output
> returning the fully expanded version -probit foreign weight price- (which I
> could then paste into the mail to the list).
> At first I sought refuge in the -e(cmdline)- returned by estimation
> commands, but that one merely expands -probit- while still leaving -f w p-
> untouched. Furthermore, it would work only for those commands that bother to
> return -e(cmdline)-. So, as a challenge to the more seasoned programmers on
> the list, is there a way to do it? If there is one, I could type my beloved
> abbreviations while posting fully expanded commands to the list...
>
>
> Martin
> _______________________
>
> *
> * 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/
>
*
* 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/