Date: Mon, 12 Feb 1996 17:54:00 -0500
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Yanhui Zhang <Yanhui.Zhang@FNB.SPRINT.COM>
Subject: Re: Macro Confusion
I don't know you got the answer or not.
You actually don't need %str and %bquote because Macro will not
misinterpret. Try this:
%do i=1 %to 8;
You missed one semicolon after the ending parentheses.
______________________________ Reply Separator
Subject: Macro Confusion
Author: SAS-L@uga.cc.uga.edu at INTERNET
Date: 2/9/96 9:11 AM
I have encountered a macro variable I can't seem to resolve and
I don't know why.
I have included the log produced by running two versions of the
macro. I changed the tail part of var1 from %str(%( keep=) to
%str(%( keep%=). The two versions put out very different results:
version 1 generated "TOT94 (keep" while version two generated
"TOT94( KEEP%= T194 T294 T394 T494 T594 T694 T794 T894 )". What I
want is "TOT94( KEEP= T194 T294 T394 T494 T594 T694 T794 T894 )".
Quotes not included in macro resolution.
My final goal is to generate a data statement with several data sets
each having a separate keep option. ie data tot1 (keep= t11 t12 t13)
tot2 (keep= t21 t22 t23) tot3 (keep=t31 t32 t33) etc. ;
Can anyone explain where my error is?
Log is included below:
NOTE: Copyright (c) 1989-1995 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) Proprietary Software Release 6.11 TS020
Licensed to INTERMEDICS, INC., Site 0016778003.
1 %macro keepmc(yr=yr);
2 %let var1=tot&yr%str(%( keep=);
3 %let var2=%str(%));
5 %do i=1 %to 8;
9 %mend keepmc;
10 options mprint nosymbolgen nomlogic;
11 data %keepmc(yr=94);
MPRINT(KEEPMC): TOT94( KEEP
12 %macro keepmc(yr=yr);
13 %let var1=tot&yr%str(%( keep%=);
14 %let var2=%str(%));
16 %do i=1 %to 8;
20 %mend keepmc;
23 data %keepmc(yr=94);
WARNING: The variable T194 in the DROP, KEEP, or RENAME list has never
NOTE: The DATA statement used 23.07 seconds.
MPRINT(KEEPMC): TOT94( KEEP%= T194 T294 T394 T494 T594 T694 T794
ERROR 23-7: Invalid value for the KEEP option.