The SAS Output Delivery System and reporting techniques

How to add HEADER??

Reply
N/A
Posts: 1

How to add HEADER??

Hi,
I am a novice user of SAS. My problem is to add a HEADER to my report, without using the TITLE function.

Any suggestions?

Best,
Valentin
SAS Super FREQ
Posts: 8,866

Re: How to add HEADER??

Valentin:
This may turn out to be a question for Tech Support, but one possible answer is to use the ODS TEXT= option.

The answer also depends on what you mean by a "HEADER". There are several different kinds of headers you could be thinking of -- 1) a pseudo-title that sits outside the table boundaries, in some destinations looks just like a title (ODS TEXT= does this); 2) a header that sits on top of a table, but inside the table box (PROC REPORT or table templates do this) ; 3) a header area that "belongs" to a destination, such as text that goes in the section of an HTML file or the kinds of headers and footers you can have in Microsoft Word or Excel (either of these are possible, but require more advanced syntax.)

The code below shows what you can do with PROC REPORT and the TEXT= option in ODS HTML. After you run this code, you will notice that the header and the footer from the COMPUTE blocks are within the boundary of the table. Compare this to the text string from the TEXT= option that will sit above the table if you put it before your PROC and sit under the table if you put it after your PROC. And, you can choose just about any PROC when you use the TEXT= option (not just REPORT).

However, the default justification for the TEXT string is left justified, which I have fixed in my ODS HTML code using HTML tags. If you are not interested in HTML, then you would have to use other techniques to justify the text and/or change the font. These techniques take us into more complicated ODS territory, because you either have to use ODS ESCAPECHAR to send style attributes for this TEXT= to ODS or you have to make a custom style template that defines the presentation attributes of the user text.

This is the point where I say that how you add a header depends on many different variables, such as:
--What do you mean by a "HEADER"?
--What is your destination of choice (RTF, PDF, HTML)?
--What is your procedure of choice (REPORT, GLM, MEANS, SAS/Graph)?
--What is your interface to SAS? (Display Manager, EG, batch programs)
--What is the final purpose of the document??
For example, you want RTF, because you need to assemble a Word document from many disparate SAS reports, so there's no point in learning how to format the user text for RTF because you will be touching the document anyway.

OR -- you need PDF or HTML output and so you MUST learn how to change the header because the users will NOT be able to change the output file after it's created.

OR -- you want to create files that you can open with Excel and you want your HEADER to be put into the PRINT PREVIEW HEADER of the Excel spreadsheet and not into the body of the document/spreadsheet (The ExcelXP tagset can do this)

The people with the best skills to gather all this information and help you decide on the right course of action are in Tech Support. You can find out how to contact them by going to the site below:
http://support.sas.com/ctx/supportform/index.jsp
Good luck!
cynthia
[pre]
*** the code;
ods html file='header2.html' style=sasweb;
ods html text='

From ODS TEXT Statement

';
proc report data=sashelp.class nowd
style(header)={background=purple
foreground=white};
column ('Spanning Header 1' name age height weight);
compute before _page_ /
style={background=pink};
line 'Line from Compute Before _Page_';
endcomp;
compute after _page_/
style={background=yellow};
line 'Line from Compute After _Page_';
endcomp;
run;
ods html close;[/pre]
Ask a Question
Discussion stats
  • 1 reply
  • 256 views
  • 0 likes
  • 2 in conversation