Statalist The Stata Listserver


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

st: syntax error using summarize command inside a macro


From   "Marcella Sapun" <msapun@jhu.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: syntax error using summarize command inside a macro
Date   Thu, 14 Sep 2006 13:33:57 -0400

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!

Marcella.
---------------------------------------------------------------------------------------------------------------
. do "C:\univariates.do"
. 
. set mem 67m 
(68608k)

. 
. use "C:\newset.dta"  
. 
. 
. #delimit;
delimiter now ;
. local vars "var1 var2 var3 var4 var5 var6 var7 
>                 var8 var9 var10 var11 var12 ... varn";

. #delimit cr
delimiter now cr
. 
. local v1 "`vars'"
. 
. local samp1 "if prown3==0"  

. foreach v of varlist `v1' {
  2. sum `v1' if `samp1' [aw=`v1']
  3. }
if not found
r(111);

end of do-file
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