| ![]() |
From | "K Jensen" <k.x.jensen@googlemail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: The Mystery Remains (was: Strange problem with stcox inside a loop) |
Date | Sun, 17 Jun 2007 11:36:21 +0100 |
Thanks for the -tuples- suggestion, Maarten. It looks like a useful command in other contexts, but I don't want to run all possible combinations of variables. So, the mystery remains. Can ANYONE out there explain why the code marked "A" below works, but the code "B" gets the error message "option nolog not allowed" when it runs model2? Please!? Yours desperately Karin *------------- begin A --------------- sysuse auto xi i.rep78 local model1 ""_Irep78*"" local model2 ""_Irep78* weight"" local models "`model1'" "`model2'" local options ", noheader" foreach m in `models' { regress price `m' `options' foreach var in `m' { testparm `var' } } *-------------- end A ---------------- *------------- begin B --------------- sysuse cancer stset studytime, fail(died) xi i.drug local model1 ""_Idrug*"" local model2 ""_Idrug* age"" local models "`model1'" "`model2'" local options ", nolog" foreach m in `models' { stcox `m' `options' foreach var in `m' { testparm `var' } } *-------------- end B ---------------- On 16/06/07, Maarten buis <maartenbuis@yahoo.co.uk> wrote:
what about Nick's -tuples- command? See: -ssc desc tuples- Hope this helps, Maarten --- K Jensen <k.x.jensen@googlemail.com> wrote:Thanks for replying, Maarten. Unfortunately, the solution you posted runs _Idrug* and age as separate models, which wasn't what I intended, and was why I used the double quotes as I did. The results on the analogous code for regress on the auto dataset that I posted before do work, and show what I was trying to do. With best wishes and thanks Karin On 16/06/07, Maarten buis wrote:The problem has to do with the way you use double quotes. It's use is explained in -help quotes-. An example that works is shown below: *------------- begin example --------------- sysuse cancer, clear stset studytime, fail(died) xi i.drug local model1 "_Idrug*" local model2 "_Idrug* age" local models `"`model1' `model2'"' local options ", nolog" foreach m in `models' { stcox `m' `options' foreach var in `m' { testparm `var' } } *-------------- end example ---------------- Hope this helps, Maarten
* * 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–2025 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |