Desktop productivity for business analysts and programmers

Automatically generating the source SAS dataset in the footnote and changing TITLE/FOOTNOTE defaults

Reply
Occasional Contributor
Posts: 17

Automatically generating the source SAS dataset in the footnote and changing TITLE/FOOTNOTE defaults

,EG automatically generates footnotes to certain outputs. From my perspective, the automatic footnotes are half useless.  I don't want the technical information about the platform, server, and software that generated the report.  But information regarding the specific dataset from which the report was generated would be extremely useful.  So I have two questions:

Is there a way to change the values of the text that is automatically generated in EG titles and footnotes?  Or would I have to ALWAYS change the defaults manually?

Is there a way to have the FOOTNOTE automatically output the name of the SAS dataset used for input?

I am assuming that SAS somehow "knows" something about the previous dataset referenced.  For example, if I issue a PROC FREQ statement without specifying DATA= SAS "knows" enough to use the dataset I just created in a DATA step.  Is there some way of having EG automatically put that information into the FOOTNOTE?


Esteemed Advisor
Posts: 5,010

Re: Automatically generating the source SAS dataset in the footnote and changing TITLE/FOOTNOTE defaults

The very smallest piece of the puzzle is available.  There is an automatic macro variable &SYSLAST which contains the name of the most recently created SAS data set.  It won't give you the complete path ... merely the name in the typical SAS form LIBNAME.DATASET.  So you would need to do further work if you wanted to know which folder held the data set.

Breaking into the E.G. report templates is going to be the harder part.

Good luck.

Occasional Contributor
Posts: 17

Re: Automatically generating the source SAS dataset in the footnote and changing TITLE/FOOTNOTE defaults

&SYSLAST will work if and only if the dataset in the procedure is the last dataset created.  In the kind of work I do, this is rarely the case.  The EG process flow will allow me to visually see which dataset was used to generate results -- but only if the procedure is invoked by a task node or I draw a link between a SAS code node and the dataset.  The real reason for generating footnotes that tell me the source file of the data is that I need to be able to read a report some time after the analysis was completed and be able to track down the EXACT source of the report.

Trusted Advisor
Posts: 1,061

Re: Automatically generating the source SAS dataset in the footnote and changing TITLE/FOOTNOTE defaults

One way you can customize your footnote is to create a "task template" from the task, with the desired changes saved. From then on, whenever you run the template task, you'll get the revised footnote.

Tom

Community Manager
Posts: 2,712

Re: Automatically generating the source SAS dataset in the footnote and changing TITLE/FOOTNOTE defaults

You can change the "default footnote" text in Tools->Options->Tasks.  This is an application-level setting that will affect all tasks (that generate footnotes).  It won't affect tasks that you've already added to your project -- just those that you create from then on.

Tom's suggest about Task Templates is also a very good idea, especially if you want to apply this to just certain types of tasks.

Chris

Trusted Advisor
Posts: 1,061

Re: Automatically generating the source SAS dataset in the footnote and changing TITLE/FOOTNOTE defaults

Chris's comment is much the better solution...I thought that facility existed, but I couldn't find it quickly.

Tom

Occasional Contributor
Posts: 17

Re: Automatically generating the source SAS dataset in the footnote and changing TITLE/FOOTNOTE defaults

The EG process flow will allow me to visually see which dataset was used to generate results -- but only if the procedure is invoked by a task node or I draw a link between a SAS code node and the dataset.  The real reason for generating footnotes that tell me the source file of the data is that I need to be able to read a report some time after the analysis was completed and be able to track down the EXACT source of the report.

The only way I see of using your suggestion for this purpose is to do something like insert "Generated from the file &file on ....".  But this will only work if I ALSO always manually modify the code with a %LET statement.  At this point, I might just as well manually modify the footnote.

As far as I can discern, there is no way to automatically have a footnote generated that tells me what dataset was used in the procedure.

Valued Guide
Posts: 2,111

Re: Automatically generating the source SAS dataset in the footnote and changing TITLE/FOOTNOTE defaults

&SYSLAST is the dataset that you would work for your initial example.  Other that that I don't think that the SAS Server knows the data set in a PROC unless you tell it.  The connections in EG are part of EG and never make it to the server.

The connections indicate links from files to tasks, but they do not determine them.  You can link any icon to another and that just determines the precedence order for sending programs to the server (EG usually tells you if you have a recursive link.).

Trusted Advisor
Posts: 1,217

Re: Automatically generating the source SAS dataset in the footnote and changing TITLE/FOOTNOTE defaults

Hi,

I think it would be fair to make your suggestion as a SAS ballot idea.

I haven't used the automatic variable &SYSPROCNAME , but it contains the name of the current proc being processed by the "SAS Language Processor".  (I guess the SAS Language Processor is a logical name for whatever controls word scanning/tokenization and sending tokens off to the appropriate compiler.)

With it you can do:

proc print data=sashelp.class;
  title "Current procedure is: &sysprocname";
run;
title;

proc means data=sashelp.class;
  title "Current procedure is: &sysprocname";
run;
title;

Personally, I don't like that style of TITLE statements (I like them before the PROC).  But since &SYSPROCNAME was implemented (I think in a fairly recent version), seems fair to ask for &SysCurrentDSN  (&SYSDSN already exists, but it is like &SYSLAST).

Without that, I would suggest either wrapping your PROC calls in a macro, so that the macro could generate the title for you, or creating a %MakeFootnote(data=) macro, where you pass it a dataset name and it makes footenote like "Run on dataset &data by &user on %now()".  But those would be more programming solutions, not sure how they would feel to an EG task user.

On the other hand, for the general purpose (linking a report back to its source), if you keep the EG project, then there are automatic macro variables that could be used in the footnote to provide the name of the EG project file that generated the report.  For many purposes, having the names of the project file / code is more useful than having the name of the data set.

Ask a Question
Discussion stats
  • 8 replies
  • 939 views
  • 6 likes
  • 6 in conversation