Titles and footnotes can be retrieved using the SASHELP.VTITLE view. So I would use that to save the current values, run your program, then run another step to reset the titles using call execute
, like this:
data _old_titles;
set sashelp.vtitle;
run;
/* do something */
footnote;
title;
/* reset titles and footnotes */
data _null_;
set _old_titles;
if type = 'T'
then cmd = catt('title',number," '",trim(text)," ';");
else cmd = catt('footnote',number," '",trim(text)," ';");
call execute(cmd);
run;
Notice there is an extra blank used after the text
value to prevent two consecutive apostrophes, which would translate into a single quote. Also not the use of single quotes to prevent any unwanted macro expansion.
Not perfect, but remember that you can have many titles and footnotes, so an option or SAS system function would be difficult to create. This has been a "feature request" many times but never implemented.
title
is not something I think should be expected to be unchanged by a user. Each PROC run should have its own title statement; if you have a title or portion of title you want consistent, save that in a macro variable. – Joe