Heikki
Heikki

Reputation: 2254

Changing SAS ODS contentitem for PROC SQL SELECT statement

When in SAS creating ODS output to a HTML file, it is also possible to create table of contents with "CONTENTS" and "FRAME" options:

ODS HTML PATH="C:\Path\" (url=none)
         BODY="body.html"
         CONTENTS="contents.html"
         FRAME="frame.html";
...
(create ODS output here)
...
ODS HTML CLOSE;

The default output is quite generic and, therefore, it is better to change the contentproclabel:

ods proclabel 'Label for the analysis';

This works in all of the cases.

It would also nice to change the contentitem. With PROC GCHART it works as follows:

proc gchart data=mydata;
block dataitem / description="Description of the graph";
RUN;

But how to change the contentitem when creating PROC SQL SELECT statement? With

ods proclabel 'Summary of analysis variables';

I can change the contentproclable in number list, but how to change the contentitem which by default is always "Query Results" in "PROC SQL; SELECT ... FROM table; QUIT;" statements?

Below is an example table of contents output from the above examples:

Table of Contents 
1. Label for the analysis
   ·Description of the graph 
2. Summary of analysis variables
   ·Query Results 

There you can see the

   ·Query Results

row whose contentitem I would like to change.

Upvotes: 2

Views: 482

Answers (1)

Joe
Joe

Reputation: 63424

You need to edit the BASE.SQL template. Bari Lawhorn shows how to do that in his paper, Let's Give them Something to TOC About on page 7.

An excerpt, modified slightly, appropriate for your specific question:

proc template; 
edit base.sql; 
  mvar sqlcl;   *This defines &sqlcl. as a macro variable that stores your value;
  contents_label=SQLcl;   *uses &sqlcl;
end; 
run; 

%let sqlcl=Summary of analysis variables;

proc sql;
  select * from sashelp.class;
quit;

Upvotes: 2

Related Questions