Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: How to find a macro containing a given string


From   Joseph Coveney <jcoveney@bigplanet.com>
To   Statalist <statalist@hsphsun2.harvard.edu>
Subject   st: How to find a macro containing a given string
Date   Tue, 23 Aug 2005 19:26:46 +0900

I'd like to be able to find the name of a macro that contains a given
string.  After -anova-, there is a list of ereturn macros that contain the
name of the term in the model and the number assigned to the term
by -anova-.  I want to be able to do arithmetic on the scalars (sum squares
and degrees of freedom) associated with that term's number by referencing
the model's term.

Example:  Let's say -ereturn list- after -anova- shows
. . .
e(term_1) : "clinic"
e(term_2) : "physician|clinic"
. . .

I would like to write a program with a syntax of, say,

-satterthwaite clinic physician|clinic . . .-

and have the program query -anova-'s ereturn macros in order to get the
names of the macros corresponding to these terms.  I can then parse the
numerals from the macro names in order to look up the corresponding ereturn
scalars, e(ss_1), e(df_1), e(ss_2), e(df_2), . . ., and do arithmetic on
them.

I've scanned through the ado-file for -test- (perhaps it's in -_test-), and
looked at -help macros-, and its linked help files, but nothing jumped out
at me.  I can always use brute force to go through the list of ereturn
macros in a loop, or concatenate their contents in-sequence (again, a loop) 
and use -posof-.  But is there anything more direct?

Joseph Coveney

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index