BookmarkSubscribeRSS Feed
Pavan_SAS
SAS Employee
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;
1 REPLY 1
Cynthia_sas
SAS Super FREQ
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]

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1414 views
  • 0 likes
  • 2 in conversation