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

st: Re: evaluating an expression in -forvalues-


From   "Richard Upward" <[email protected]>
To   <[email protected]>
Subject   st: Re: evaluating an expression in -forvalues-
Date   Wed, 17 Dec 2003 09:25:45 +0000

As usual, thanks to Nick for his help with this.  I think I need a 
"how to find what you want in those manuals" course.
The answer was on page 230 in [P].  I was looking in [U] 21.3.

Richard

--
Nick Cox wrote:

You can get evaluation on the fly with `=exp' 
where "exp" is an expression to be evaluated. 
That expression can itself include local macros.
So 

forval i = 1(1)`=`t'+2' { 
	...
} 

or 

forval i = 1/`=`t'+2' { 
	...
} 

Note that this is nothing to do with -forvalues- 
as such. It is a general device for handling 
macro evaluation, added in Stata 7 (but not documented) 
and documented in Stata 8. For example, start at the 
on-line help for -macro-. 

There was also related discussion within SJ 3(2):185--202
(2003). 
--

Richard Upward
School of Economics
University of Nottingham
University Park
Nottingham NG7 2RD
Tel: +44 (0) 115 95 14735

http://www.nottingham.ac.uk/economics/staff/details/richard_upward.html


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