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

Re: st: assistance with syntax


From   Richard Williams <[email protected]>
To   [email protected]
Subject   Re: st: assistance with syntax
Date   Mon, 09 May 2005 11:51:30 -0500

At 11:46 AM 5/9/2005 -0500, Sheela Athreya wrote:
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.

Thanks very much.
Stata 8 doesn't like the way you are using {}  Try

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


-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX:    (574)288-4373
HOME:   (574)289-5227
EMAIL:  [email protected]
WWW (personal):    http://www.nd.edu/~rwilliam
WWW (department):    http://www.nd.edu/~soc

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