LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (June 2000, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 5 Jun 2000 16:57:17 -0700
Reply-To:     "Lund, Pete" <Peter.Lund@CFC.WA.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Lund, Pete" <Peter.Lund@CFC.WA.GOV>
Subject:      Re: passing equal sign as a parameter in macro
Comments: To: Annie Chang <chang5a@YAHOO.COM>
Content-Type: text/plain; charset="windows-1252"

Annie-

Since the "=" has meaning to the macro processor (signifying a named parameter) you need to "mask it" so that the macro doesn't try to do something with it. You do this with a macro quoting function. In your simple example, just change your call to the macro to:

%test (%str(new = 3));

The %str() function masks the meaning of the "=" and the macro just treats it as text.

If you want some fascinating reading, check out the section on macro quoting functions in the SAS Macro Language Reference Guide. Better yet, get Art Carpenter's "Carpenter's Complete Guide to the SAS Macro Language" - you'll learn a lot!

Hope this helps.

Pete Lund WA State Caseload Forecast Council (360) 902-0086 voice (360) 902-0084 fax peter.lund@cfc.wa.gov

-----Original Message----- From: Annie Chang [mailto:chang5a@YAHOO.COM] Sent: Monday, June 05, 2000 4:48 PM 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; &var; %mend;

%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! http://photos.yahoo.com


Back to: Top of message | Previous page | Main SAS-L page