Date: Fri, 19 Sep 2008 05:52:29 -0700
Reply-To: Lou <lpogoda@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Lou <lpogoda@HOTMAIL.COM>
Organization: http://groups.google.com
Subject: Re: Displaying information in the log file about which file is
being processed
Content-Type: text/plain; charset=ISO-8859-1
On Sep 19, 1:28 am, "Rune Runnestø" <r...@fastlane.no> wrote:
> Hi!
> I figure that if I could write a macro and let the start of each file that
> are being processed during the execution of a program telling the user which
> file SAS is processing at the moment, then it would make it easier to find
> and debug the program when errors or warnings occur. It doesn't necessarily
> have to be a macro, but the convenience of a macro is that it doesn't take
> much place when it is called, just one or two lines of code. For example:
> %find_filename
> %display_filename_in_log(&this_file)
>
> Below is an example of code. It can easily be enclosed in a macro. This can
> for instance be (part of) the content in the macro
> %DISPLAY_FILENAME_IN_LOG(this_file).
>
> data _null_;
> do;
> put "NOTE:
> ***************************************************************";
> put "NOTE: * The file being executed at the moment is named
> '&File_001' ";
> put "NOTE:
> ***************************************************************";
> end;
> run;
>
> But SAS has no chance to know that &FILE_001 resolves to for example
> 'C:\TEMP\test.sas'. Is it a way that SAS can catch this metadata information
> so i can assign it to the value of the macro variable %let
> THE_PRESENT_FILE_EXECUTED?
>
> I guess SAS by default tells which file is being processed, but what I am
> looking for is a more conspiuous way to tell the programmer this
> information, so that errors can be faster to track.
>
> I wouldn't be surprised if there are already written macros for this
> purpose.
>
> Regards, Rune
It's not entirely clear what you're aiming at. In the example you
give, no file is being processed at the moment - you're in a DATA
_NULL_ step without an INFILE or FILE statement. And no DATA step
process, macro-ized or not, is going to tell you what file is being
processed by a PROC - PROC IMPORT for example.
If you're trying to display external files being processed (input or
output) by a DATA step, the FILEVAR option of the INFILE and FILE
statements already provides this information - there's no need to
write something new.
Frankly, I don't think making the physical name of the file displayed
at the bottom of the DATA step "more conspicuous" is going to help
much - it's just more clutter on the LOG, and makes the program more
complicated.
|