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 2004, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 14 Jun 2004 12:32:20 -0700
Reply-To:   "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Subject:   Re: Macro [ab]usage (was: (OT) old style macro is still working)

Don't forget the elegant macro-based access to the dictionary meta-data with SQL Select Into - functionality only accessible via SAS Macro.

Paul Choate DDS Data Extraction (916) 654-2160

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Paul M. Dorfman Sent: Monday, June 14, 2004 10:52 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Macro [ab]usage (was: (OT) old style macro is still working)

Quentin McMullen, in part wrote:

> So to rename a group of variables, I can code: > > data b; > set a (rename=(%rename(x y z,prefix=_))); run; > > Now in that sort of situation, I believe %include could not > work, it doesn't seem happy in the middle of a statement, e.g.: > > data b; > set a (rename=(%include "c:\junk\renamelist.sas")); run;

Quentin,

You are correct, the rules of %include require that its source must contain complete SAS statements. However, nothing prohibits one to generate the entire SET statement complete with the semicolon with the needed variables duly renamed, which is what is usually done when this technique is used. It has its unwritten rules (those may be somewhat personal) designed to make the code being generated eminent enough to be distinguished from the generating Data step code. I agree, though, that the macro language makes the distinction more starkly apparent, partially because its syntax is different. And I also agree that in the case above, the macro is right in its place: PUT/include would have to generate the whole statement, and Call Execute's purpose would be much more difficult to comprehend. If there are cases (as I believe) when a macro is more self-explanatory about the purpose of the action than the code it generates, this is one of the cases.

Kind regards, ---------------- Paul M. Dorfman Jacksonville, FL ----------------


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