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

st: forvalues problem


From   Fred Wolfe <[email protected]>
To   [email protected]
Subject   st: forvalues problem
Date   Wed, 31 Jul 2002 22:14:42 -0500

Can anyone see the problem?

I have global macros

mac list
catvar1_totline: 2
catvar2_totline: 9

When I try to use them with the following code I get an error

forvalues j = 1 / 2 {
forvalues k = 1 / ${catvar`j'_totline} {
di "`k'. ${catvar`j'vname`k'"
}
}

The error is:

- forvalues k = 1 / ${catvar`j'_totline} {
unrecognized command: catvar1_totline

Leaving the braces off gives "invalid syntax."

. di ${catvar1_totline}
2


Thanks

Fred






---------------------------------------------------------------------------- ------------------------
Fred Wolfe Tel (316) 263-2125
National Data Bank for Rheumatic Diseases Fax (316) 263-0761
Wichita, Kansas [email protected]
---------------------------------------------------------------------------- -------------------------

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