Date: Tue, 8 May 2007 05:30:35 -0400
Reply-To: ben.powell@CLA.CO.UK
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: ben.powell@CLA.CO.UK
Subject: Re: Possible to set macro var to datastep varname within datastep?
Apologies that was a poor example as it implied a numeric variable. It is
actually safe to assume the variable is always text.
So the example should be :-
%macro valx();
x="code"||x;/*simplified example*/
%mend;
data a;
x="abc";/*x may be called y but valx should run the same for both*/
%valx;
run;
On Fri, 4 May 2007 10:49:58 -0400, ben.powell@CLA.CO.UK wrote:
>Dear List
>
>I have a snippet of code to run in a datastep as a macro - so the same code
>is run wherever by autocall. Is it possible to test for the var that code
>should run against within the same datastep and pass it to the macro? Is it
>possible to do all this in the same macro?
>
>%macro valx();
>x=10*x;/*simplified example*/
>%mend;
>
>data a;
>x="abc";/*x may be called y but valx should run the same for both*/
>%valx;
>run;
>
>The situation arises to cater for when non-standard var lengths are
>encountered, e.g. the import variable temp is converted to the standard
>variable x.
>
>Any comments much appreciated.
>
>Rgds.