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

Re: st: RE: forvalues problem


From   Fred Wolfe <fwolfe@arthritis-research.org>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: forvalues problem
Date   Thu, 01 Aug 2002 04:39:46 -0500

Thanks  to Zhiqiang Wang and Nick Cox for their comments and suggestions.

Nick writes further

A quite different comment is that it's not clear
why you need the { } around the macro name in that position.
It is not clear to me either, but running the program without braces produced:

- forvalues j = 1 / 2 {
- forvalues k = 1 / $catvar`j'_totline {
invalid syntax
di "`k'. ${catvar`j'vname"`k'}"
r(198);

Zhiqiang's suggestion does work when the braces are used:

- local testvar = ${catvar`j'_totline}
- forvalues k = 1 / `testvar' {
- di "`k'. `testvar'"
1. 9
- }
- di "`k'. `testvar'"
2. 9
<snip>
}
}

Fred



---------------------------------------------------------------------------- ------------------------
Fred Wolfe Tel (316) 263-2125
National Data Bank for Rheumatic Diseases Fax (316) 263-0761
Wichita, Kansas fwolfe@arthritis-research.org
---------------------------------------------------------------------------- -------------------------

*
* 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index