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

st: automatically creating variables names


From   "Maria Montez" <[email protected]>
To   <[email protected]>
Subject   st: automatically creating variables names
Date   Mon, 2 May 2005 18:29:28 -0400

Hi!

On my simulation I need to create a second set of variables names because
I'm running two part models. I'm using the following commands, which are
supposed to append a one at the end of each variable name:

global indvar Dagesex1 Dagesex2 Dagesex4-Dagesex10 ///
	x01-x16 x18-x46 adg1-adg14 adg16-adg18 adg20-adg22 ///
	adg26-adg34 Drace2-Drace6 prio_7

foreach x of global indvar {
	global pbetas $pbetas `x'1
}

However, the foreach loop does not work because I have lists of variables in
the global indvar, e.g. Dagesex4-Dagesex10.

Does anyone have a fix for this problem other then having to type each one
of the variables separately.

Thanks, Maria

*
*   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