Date: Fri, 4 Nov 2005 14:52:24 +0000
Reply-To: toby dunn <tobydunn@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: toby dunn <tobydunn@HOTMAIL.COM>
Subject: Re: Forcing SAS to print the resolved value of macro variables in
the log
In-Reply-To: <436b723c$0$1747$5a62ac22@per-qv1-newsreader-01.iinet.net.au>
Content-Type: text/plain; format=flowed
Scott,
Uhhhh its not really going to happen, I think. All the log does (if there
is no macro options turned on) is echo what was submitted and any notes
warnings and errors. When you turn the macro options mprint etc... on it
also echos what the resolved macro definition submitted to be processed to
the log.
The best I can come up with right now is doing something like the following:
options mprint;
%let foo=bar;
title "&foo" ;
%put title "&foo" ;
%macro foo ;
title "&foo" ;
%mend ;
%foo
Toby Dunn
From: Scott Bass <usenet739_yahoo_com_au@ALFREDO.CC.UGA.EDU>
Reply-To: Scott Bass <usenet739_yahoo_com_au@ALFREDO.CC.UGA.EDU>
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Forcing SAS to print the resolved value of macro variables in
the log
Date: Sat, 5 Nov 2005 01:37:48 +1100
Thanks Ron, that was a typo. That will teach me to try to improve the
posted testcase without retesting. I've corrected the code below.
"Scott Bass" <usenet739_yahoo_com_au> wrote in message
news:436a97b1$0$1745$5a62ac22@per-qv1-newsreader-01.iinet.net.au...
> Hi,
>
> Summary:
>
> Submit this code:
>
> 1 options mprint;
> 2 %let foo=bar;
> 3 title "&foo"; <<<<<
> 4 %macro foo;
> 5 title "&foo";
> 6 %mend;
> 7 %foo;
> MPRINT(FOO): title "bar"; <<<<<
>
> I wish there was some way I could force line 3 in the log to be the
> resolved value of the macro variable, like line 7, rather than the macro
> variable reference.
>
> Details/Rationale:
>
> We have an SDLC requirement to document the test cases within our
> programs. The problem is, our test case documentation was always out of
> sync with the test cases in the programs themselves.
>
> Therefore, I wrote a Perl script (thanks comp.lang.perl but, man, what a
> TOUGH crowd on the newbies) plus a bit of SAS (thanks Richard) that
parses
> .sas or more often .log files for specially formatted comment blocks, and
> generates the test case documentation. This is analogous to JavaDoc or
> Perl POD, where the documentation for the program is embedded in the
> program itself.
>
> I've encountered a problem, for which I need to come up with a
> workaround/best practice. If the documentation block contains macro
> variable references, outside of a macro, the SAS log will print the macro
> variable reference, rather than the resolved value. Therefore, the
> reference, rather than the value, ends up in the doc.
>
> My Perl script does handle/parse out the "MPRINT (FOO):" text, so the
> immediate workaround is to force the end user to use a macro if the test
> case block contains macro variables. However, this does add
> complexity/additional code, just to get the log to read "properly". I
was
> hoping there was some magical, undocumented, whizbang SAS option that
> would give me what I want.
>
> Or some brilliant idea/alternate approach/workaround from a fellow
> SAS-L'er.
>
> Cheers,
> Scott
>
|