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 (October 2006, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 2 Oct 2006 22:53:17 -0400
Reply-To:   "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject:   Re: Help on Macro for Reading Data

On Mon, 2 Oct 2006 09:05:45 -0400, Peter Crawford <peter.crawford@BLUEYONDER.CO.UK> wrote:

>On Mon, 2 Oct 2006 16:31:32 +1300, John Fouhy <john@FOUHY.NET> wrote: > >>On 02/10/06, Ian Whitlock <iw1junk@comcast.net> wrote: >> >>Hi Ian, >> >>I found your post quite interesting. I have one quesiton; you said: >> >>> All of the above work has been tested to see that the expected >>> SAS code is generated, i.e. the macro algorithms work. I have >>> not tested that the SAS code also works, but I do not see >>> anything wrong with the generated code. >> >>How can I easily see the SAS code generated by a macro? I know I can >>turn MPRINT on, but then I need to do further manual processing if I >>want to create SAS executable code. Is there an easy way to get the >>executable code produced by a macro? >> >>-- >>John. > > >John > >you can capture the text generated by macros by using the option >MFILE. >This defaults to NOmfile. >When the options MPRINT and MFILE are "on", and a "filename" is >allocated with the fileref MPRINT, the MFILE option writes a copy >of the text/code generated by macros to the file allocated with >fileref MPRINT

That seems like the best solution, but the RESOLVE function can also be exploited, and might make sense for the scenario where there are a lot of short texts.

Try this demo:

%macro test(a,b); Result will embed passed-in values &a and &b! %mend;

data _null_; macroresult = resolve('%test(eenie,meenie)'); put macroresult=; run;

It should print

macroresult=Result will embed passed-in values eenie and meenie!

> >Good Luck > >Peter Crawford


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