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

st: looping with macro names

From   Chris Rohlfs <>
Subject   st: looping with macro names
Date   Thu, 27 Mar 2003 10:08:42 -0600 (CST)


i'm trying to make a loop to run statements like:

	qui gen `mathXfirst' = math*first
	qui gen `englishXfirst' = english*first
	qui gen `other_acadXfirst' = other_acad*first

	qui gen `mathXst' = math*st
	qui gen `englishXst' = english*st
	qui gen `other_acadXst' = other_acad*st

where the first variable in each case is a tempvar name and hence inside
quotation marks.  is there a way to do something like:

	for C in var math english other_acad: for V in var first st: ...

or something with foreach that will replace the V and C with variable
names, even inside the quotation marks?


*   For searches and help try:

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