Date: Tue, 6 Jun 2000 14:05:52 +0200
Reply-To: Jim Groeneveld <J.Groeneveld@ITGROUPS.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jim Groeneveld <J.Groeneveld@ITGROUPS.COM>
Subject: Re: passing equal sign as a parameter in macro
How about this:
%MACRO DeQuote (Arg);
%LET Length = %LENGTH(&Arg);
%IF %INDEX(%STR(%"%'),%QSUBSTR(&Arg,1,1)) AND &Length>1 AND
%MACRO Test (Arg);
%LET Arg = %DeQuote(&Arg);
%PUT DeQuoted Arg=&Arg;
So you may pass a quoted argument with just single or double quotes to a
macro and remove those quotes within the macro using the macro
(function-like) %DEQUOTE. HTH - LMK.
Regards - Jim.
Y. (Jim) Groeneveld, MSc IMRO TRAMARKO tel. +31 412 407 070
senior statistician, P.O. Box 1 fax. +31 412 407 080
head IT department 5350 AA BERGHEM IMRO TRAMARKO: a CRO
J.Groeneveld@ITGroups.com the Netherlands in clinical research
My computer does not need me at all, but I can't do without it anymore.
> -----Original Message-----
> From: Annie Chang [SMTP:chang5a@YAHOO.COM]
> Sent: Tuesday, June 06, 2000 1:48 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: passing equal sign as a parameter in macro
> I think i have a hard question:
> %macro test ( var);
> data tmp;
> set dataset;
> %test ( "new = 3");
> What I am doing here? I am trying to pass an equal
> sign "=" to the macro.
> (don't complain about the silly example, I make it up
> so that my question
> is easier to explain). But it doesn't work. Since if I
> quote it,
> &var becomes
> "new = 3";
> the quotation marks become errors. However, if I just
> call it like
> %test ( new = 3);
> sas will complain that there is no key parameter as
> 'new'. i.e., sas treats
> the equal sign as a default definition for a
> parameter, and won't pass the
> whole thing 'new = 3' to &var.
> I tried all those quote functions but to no avail.
> Need an expert in SAS
> to help!!
> Thank you.
> Do You Yahoo!?
> Yahoo! Photos -- now, 100 FREE prints!