Date: Wed, 17 Aug 2005 15:38:18 -0400
Reply-To: Sigurd Hermansen <HERMANS1@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Sigurd Hermansen <HERMANS1@WESTAT.COM>
Subject: Re: Help with a Macro resolution problem
Content-Type: text/plain; charset="us-ascii"
.... %let new=VAR1; assigns the string 'VAR1' to the macrovariable &new.
No, the Data step assignment VAR1=....; will not execute until after the
Macro executes. The Macro assignment %let var1= ...; assigns a character
string from the right side of the '=' to the macrovariable &var1. Were I
you, I'd hold off on writing Macro loops until I developed a better
understanding of Macro processing. Take a step back and study the order
of execution of elements in a SAS program vector.
If you are trying to write a Macro that will substitute a value for a
parameter in a reporting procedure, why not describe what you want to do
in a SAS-L post. A number of Macros already exist and you could learn a
lot from studying appropriate ones that SAS-L participants are willing
to share.
Sig
-----Original Message-----
From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu]
On Behalf Of monal kohli
Sent: Wednesday, August 17, 2005 3:17 PM
To: Sigurd Hermansen; SAS-L@LISTSERV.UGA.EDU
Subject: RE: Help with a Macro resolution problem
Thanks Sig,
but the problem here is I want to create &new equals
to "11" ,"12","13".That is VAR1='11' and the &new=11
or
&new=var1.
So Is there a way I can do this:
%let var1=%str('1'||"&j");
I cannot use CALL SYMPUT because I have to use the
values in the same datastep.
Thanks
Monal
--- Sigurd Hermansen <HERMANS1@WESTAT.com> wrote:
> Monal:
> You are mixing modes ....
> .....
> %DO J = 1 %TO 3;
> VAR1= "1" || TRIM(LEFT(J));
>
> %let new = VAR1;
>
>
> END; <<<<<<<<< replace with %END.
> Sig
>
> -----Original Message-----
> From: owner-sas-l@listserv.uga.edu
> [mailto:owner-sas-l@listserv.uga.edu]
> On Behalf Of monal kohli
> Sent: Wednesday, August 17, 2005 2:47 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Help with a Macro resolution problem
>
>
> Hi All,
> Can someone point out what's wrong with this,why
> is
> the macro variable new not getting the value of
> var1.
> I cannot use call symput,so I have to stick to %let
> .
>
>
> %MACRO PRNTRPT;
> %GLOBAL new;
> DATA _NULL_;
> LENGTH VAR1 VAR2 VAR3 $3;
> %DO J = 1 %TO 3;
> VAR1= "1" || TRIM(LEFT(J));
>
> %let new = VAR1;
>
>
> END;
> RUN;
> %PUT _USER_;
>
> %PUT "THE VALUE OF new IS " &new;
> %mend;
> %PRNTRPT;
>
>
>
> Thanks
> Monal
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam
> protection around
> http://mail.yahoo.com
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com