Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: loop and local question with appendmodels


From   moleps islon <[email protected]>
To   [email protected]
Subject   st: loop and local question with appendmodels
Date   Wed, 29 Apr 2009 12:48:09 +0200

I'm trying to create a local variable that creates a new local with
more variables, hard to explain but easier to see the code:



eststo clear
local r "a b c d e f"
local t=0
foreach x of local r {
	stcox "`r'"
	eststo e`t'
	
	
	local t=`t'+1
		
	}
eststo u: appendmodels e0 e1 e2 e3 e4 e5
esttab u



But what I want to do is to create a new local var that can take any
number of variables in r and automatically create a local g that can
be used in the appendmodels command, eg

eststo clear
local r "a b c d e f g h..."
local t=0
foreach x of local r {
	stcox "`r'"
	eststo e`t'
	
	
	local t=`t'+1
	//generate some kind of appended local here (q), that I cannot figure out//	
	}
eststo u: appendmodels `q'
esttab u

The thing is that appendmodels doesnt allow e0-e8 notation.

Regards
moleps
*
*   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/



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