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

st: Accessing estimation syntax


From   Allan Garland <[email protected]>
To   [email protected]
Subject   st: Accessing estimation syntax
Date   Wed, 30 Nov 2005 06:41:44 -0500

Dear All,

I am writing a post-estimation program as an ado file. In this program I want to take the Cox regression model that was estimated using -stcox- and add a couple of extra options to the syntax, and then run it again within the ado file.

I know that if I just write a line of code that is: stcox
that it will replay the existing model, but it does not seem there is a way to invoke the existing model syntax and just add extra options to it. I know a tedious way to do it, i.e. by accessing every component of the original syntax separately within the "e" output (e.g. getting the method of breaking ties as e(method), etc) and then explicitly stringing together all these separate items together as a single local macro in order to fully reconstruct the original syntax.
BUT, I'm hoping that there is a quick and elegant way to access the ENTIRE syntax of the currently estimated model and put it all at once into a single macro, so for instance I'd call that macro `everything' and then once I've accessed it I can just go: stcox `everything' newoption1 newoption2


To flesh it out just a bit, here's an example:
-syntax of the estimated model: stcox age ap2 los, strata(race) tvc(los)
-I'm looking to find an easy way after estimating this model to obtain the string "age ap2 los,strata(race) tvc(los)" so I can stick it into a local macro within my ado file, call it `everything'
-So that then within my routine I can write: stcox `everything' mgale(mg) esr(sr) and it will then execute the command as follows:

stcox age ap2 los, strata(race) tvc(los) mgale(mg) esr(sr)

Thanks,

Allan





*
* 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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index