Date: Fri, 15 Jun 2007 07:41:34 -0400
Reply-To: "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Organization: Internet News Service
Subject: Re: loop through string macro variable
Dirk Nachbar wrote:
> The code below creates "var x11-x21; var y11-y21; var z11-z21;"
No it doesn't. It should generate
var x11-x21; y11-y21; z11-z21;
> although it want to create "var x11-x21 y11-y21 z11-z21" (prod=10).
> How to get around that. Thanks.
>
> proc summary data=temp;
> class store week;
> var %let j=1;
> %do %while (%scan(&vars, &j, %str( ))> );
> %let var=%scan(&vars, &j, %str( ));
> &var.11-&var.%eval(10+&prod);
> %let j=%eval(&j+1);
> %end;
> output out=tupcdata (where=(_type_=3)) sum= ;
> run;
>
> Dirk
remove the semi colon from
> &var.11-&var.%eval(10+&prod);
&var.11-&var.%eval(10+&prod)
Place a bare semicolon after the %end; to generate VAR statement terminus
;
--
Richard A. DeVenezia
http://www.devenezia.com/