If the program is indeed being run interactively, that means that the user
can include a new program at any point in time. I presume that you would
want the program name to be updated to reflect that.
There is no way that I am aware of that would automatically update an
already existing footnote to reflect the new value of a macro variable or
system variable. Since macro is a code generator, the value will be resolved
when the footnote statement is encountered and the value will be resolved
then. Once the footnote statement has been parsed, there is no way (that I
know of) to have it automagically be updated other than repeating the
The macro is not called again when you run a proc that uses a previously
defined footnote statement.
You might look to see if there is a way to do this with a custom ODS
template that could perhaps reference the variable. However, I am not sure
if/how that would work. I would have to defer that to a template guru.
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Michael
Sent: Wednesday, April 25, 2007 3:48 PM
Subject: Re: delaying macro execution until runtime of a procedure
Evan Davies posted the following:
> I am setting up an office-wide autoexec.sas file that has a macro
> called %prog_pathname in it that resolves to the path and name of the
> program thatis running interactively. (The macro was written by Steve
> James firstname.lastname@example.org, and is in the sas-l archives for Aug 4, 2006. It
> makes use of the SAS_EXECFILEPATH system var.)
> If I put footnote "This program is: %prog_pathname ";
> in any procedure step in an interactive job session, the macro is
> executed correctly and the path and name of the executing program is
> printed in the footnote.
> But I would like to put the footnote statement into the
> autoexec.sas file as well, so that my fellow officeworkers and I do
> not have to code the footnote statement into every proc step that we
> write. This would also insure that the true path and program are
> named. We currently use %let declaration statements for the path and
> program name, and after a program is passed around the office a few
> times, we sometimes get sloppy and forget to change the %let statement
> to the newly modified path or program revision name. Having the
> footnote statement execute automatically would prevent this.
> But putting the footnote statement containing the macro into the
> autoexec.sas file (after the macro definition) results in it being
> executed immediately and the macro resolves to a blank, since at the
> time of the execution it is in the autoexec.sas file and nothing has
> been loaded to the SAS_EXECFILEPATH system variable.
> Can anybody tell me how to delay the execution of the macro in the
> footnote statement until it is called in the runtime execution of the
> program's proc statements? I realize that since the footnote statement
> is merely "implied" or "associated" with any proc that can use a
> footnote statement, if it is not explicitly coded in the proc step,
> this may be problematic. But has anyone implemented an automatic path
> and file footnote solution using this appproach?
Evan, I have an untested suggestion that may be just what you need.
Check out the INITSTMT option. It is specified in the SAS config file and
executes after the autoexec, but before the SAS program, itself.
This may or may not work, but it is worth a looksee.
Here is a link to where you could find it in the SAS Online
Let us know if it is still too early in the SAS initialization process to be
able to capture the program path. (If it does not, then I think that the
obtrusive %INCLUDE is your only other option).
Evan, best of luck to you in getting your program path footnote into your
I hope that this suggestion proves helpful now, and in the future!
Of course, all of these opinions and insights are my own, and do not reflect
those of my organization or my associates. All SAS code and/or methodologies
specified in this posting are for illustrative purposes only and no warranty
is stated or implied as to their accuracy or applicability. People deciding
to use information in this posting do so at their own risk.
Michael A. Raithel
"The man who wrote the book on performance"
Author: Tuning SAS Applications in the MVS Environment
Author: Tuning SAS Applications in the OS/390 and z/OS Environments, Second
Author: The Complete Guide to SAS Indexes
Man is the only animal who laughs and has a state legislature. - Samuel