Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: syntax error using summarize command inside a macro


From   "Michael Blasnik" <michael.blasnik@verizon.net>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: syntax error using summarize command inside a macro
Date   Thu, 14 Sep 2006 13:58:42 -0400

You have the if in the command and also in the macro so that Stata sees "if if"

M Blasnik

----- Original Message ----- From: "Marcella Sapun" <msapun@jhu.edu>
To: <statalist@hsphsun2.harvard.edu>
Sent: Thursday, September 14, 2006 1:33 PM
Subject: st: syntax error using summarize command inside a macro



Hi there,

I am trying to produce a summary statistics on a series of variables
using the command SUM inside a macro subroutine. Apparently, my
"try=off" program (see below) is not working because a syntax error. I
cannot find the error. Would anybody be able to see it?

Thanks!

<snip>
. local samp1 "if prown3==0"

. foreach v of varlist `v1' {
 2. sum `v1' if `samp1' [aw=`v1']
 3. }
if not found
r(111);
*
*   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