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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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