Date: Thu, 15 May 2008 11:13:30 -0400
Reply-To: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Subject: Re: %str question?
note that batchcode is not a macro, but a macro variable! You should try
to make a macro if you need that:
%macro batchcode(nvisit=);
%do i=1 %to &nvisit;
%do j=1 %to...
...
%end;
%end;
%mend;
...
Proc ...
class xxxx;
var %batchcode(nvisit=5);
output out=xx
mean(%batchcode(nvisit=5) N=;
run;
Don't know if that works. Would be helpful to see error messages!
Gerhard
On Thu, 15 May 2008 09:57:57 -0500, Amy Sun <tonyliang20032@GMAIL.COM>
wrote:
>Hi, All;
>
>I have the following code, and want to refer the macro &batchcode, in some
>other place,
>
> %let batchcode = %nrstr(
> %do i = 1 %to &nvisit;
> %let vis_a = %scan(&vValList, &i, %str( ) );
> %do j = 1 %to &nvisit;
> %let vis_b = %scan(&vValList, &j, %str( ) );
> STD_&vis_a.&vis_b
> %end;
> %end;
>);
>
>e.g. in some procedure,
>
> proc summary data = datacov mean;
> class trt;
> var &batchcode;
> output out = stat_cov
> mean = &bathcode N = ....;
>run;
>
>there are some error message in the log, then how can I corrrectly define
>the macro &batchcode.
>
>Thank you in advance for your suggestions.
>
>Best regards,
>Amy
|