Help using Base SAS procedures

how to hide title for furhter by groups?

Reply
SAS Employee
Posts: 73

how to hide title for furhter by groups?

I am using the following code and getting title1 printed for each by group.
Actullay i want title1 to pring before 1st by group only (very beginning of the report).

Plz give me the hint to 'noprint' the title for further by groups.
I am creating HTML report.

data a;
input gender $ age;
cards;
f 1
m 2
f 3
m 6
m 8
m 9
;
run;
proc sort data=a;
by gender;
run;

title1 "Pavan";
proc freq data=a;
by gender;
tables gender age / list;
run;
SAS Super FREQ
Posts: 8,739

Re: how to hide title for furhter by groups?

Hi:

You can only "reset" or change titles between program steps -- that generally means at step boundaries -- so you can't reset the TITLE statement between BY groups.

However, rather than thinking about how to "turn off" or "hide" the second title statement, think instead about turning off ALL titles and using an alternative method to put text at the top of the output.
That alternative method is the ODS TEXT= option.

If you look at the program below, run the code and review the results, you will see that ODS TEXT= puts a text string at the very top of the report -- before the first BY group from PROC FREQ. ODS TEXT= is a one-time insertion of a text string...so it will NOT repeat for the second BY group.

Usually, the text string that you specify is left justified and in a small font. BY using the <H3> tag, I am getting title-like formatting, without using a TITLE statement. (There is an alternate way to format the TEXT= string, but it involves using a style template, which would be the method you'd have to use for RTF and PDF -- but since HTML has the lovely <H3> tag, that seems a simpler approach for HTML output.

cynthia
[pre]
ods listing close;
ods html file='c:\temp\freqlist.html' style=sasweb;
title1; footnote;
** 1) create output WITHOUT titles or footnotes;
** 2) and then use ODS TEXT= to place text before FREQ starts (which will be before first BY group);
** Note if using SAS 9.1.3, need to use ODS HTML TEXT= option;

ods text='<div><h3 align="center"> Pavan</h3></div>';
proc freq data=a;
by gender;
tables gender age / list;
run;

ods html close;
[/pre]
Ask a Question
Discussion stats
  • 1 reply
  • 447 views
  • 0 likes
  • 2 in conversation