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

st: RE: assistance with syntax


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: assistance with syntax
Date   Mon, 9 May 2005 17:53:49 +0100

On occasion Stata gets it right. The error is 
as indicated. The code should be (with 
comments added). 

				 //	"{" is an open brace  
foreach pc of varlist _all {
				 //   the code should follow on 
 	                   //   the next line. 
	egen z`pc'=std(`pc')
} 

As you say, this syntax works across all operating systems. 

Nick
n.j.cox@durham.ac.uk 

Sheela Athreya, Ph.D. 

Can anyone please tell me what is wrong with the syntax of the following command? 

foreach pc of varlist _all {egen z`pc'=std(`pc')} 

I get the error message "program error: code follows on the same line as open brace 
r(198); " 

I haven't used this command to standardize a set of variables in a long time, and have unfortunately maxed out my creative abilities to solve this problem. I'm using Intercooled Stata 8 for the Macintosh, although I'm pretty sure the syntax should be universal for this particular command. 

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