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   "Marcella Sapun" <msapun@jhu.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: syntax error using summarize command inside a macro
Date   Thu, 14 Sep 2006 14:42:15 -0400

Thank you Michael.


>>> Michael Blasnik <michael.blasnik@verizon.net> 9/14/2006 1:58 PM
>>>
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/
*
*   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