BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,
My code is as follows
proc sort data=sashelp.class out=class;
by sex;
run;
ods pdf;
proc report data=class nowd;
by sex;
run;
ods pdf close;

On Excueting the above code,I am getting the table with SEX='F' in first page and SEX='M' in second page.Now I want to display the number of Females at the bottom of first page as ' Total number of Females: 9 ' and the number of Males at the bottom of second page as ' Total number of Males: 10 '.
Please help me in doing the above task.

Thanks in advance.
4 REPLIES 4
deleted_user
Not applicable
not only can you (clip from TITLE online doc)
Example 2: Customizing Titles by Using BY Variable Values
as in the link http://support.sas.com/onlinedoc/913/getDoc/en/lrdict.hlp/a000220968.htm#a002659438 , iirc, you can place the same customisation into footnotes.

PeterC
deleted_user
Not applicable
Hi Peter,
I don't want to insert either the Value of By-Variable or the Name of By-Variable or the By-Line ,I want to insert the number of obervations present in each By group at the bottom of the respective tables .
deleted_user
Not applicable
sorry Sivas

Even having obtained a solution that populates the by-value with the count for the by-group, it will still not be enough anyway, because you want it in the footer.
I'm now safely able to declare (from testing in SAS913) that #byval and #byvar do not operate in footnotes.

I expect Cynthia has found a solution for you.


PeterC
Cynthia_sas
SAS Super FREQ
Hi:
I had a version of this program as an example in my paper, Creating Complex Reports, which I presented at SAS Global Forum. The paper can be found here:
http://www2.sas.com/proceedings/forum2008/173-2008.pdf (see page 2 for your report...it can be produced with PROC PRINT, PROC REPORT and DATA _NULL_).

And the programs can be downloaded from here:
http://support.sas.com/rnd/papers/ (scroll until you see the paper title....then follow the link to download the zip file of programs.)

There are a couple of other ways to put extra summary lines at the bottom of PROC REPORT output, without going down the PROC TEMPLATE road (just yet!).

cynthia
ps...in the programs to download, this program is called figure1_2.sas -- however, it did not use BY group processing. I've changed the PROC REPORT example below to use BY group processing (in which case, you might want to NOPRINT the DEFINE statement for SEX in the code, after you see how it's working.)
[pre]
proc sort data=sashelp.class out=class;
by sex name;
run;

title; footnote;
ods listing close;
ods html file='figure1_2.html' style=egdefault;

proc report data=class nowd
style(summary) = Header
style(lines) = Header;
by sex;
column sex name age height height=htdisp;
define sex / group
style(column)=Header;
define name / display;
define age / display;
define height / n noprint;
define htdisp /sum;

compute after sex;
if sex = 'F' then
prtline = 'Female Students N ='||put(height.n,3.0);
else if sex = 'M' then
prtline = 'Male Students N ='||put(height.n,3.0);
line prtline $30.;
endcomp;

run;
ods html close;
[/pre]

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 4 replies
  • 626 views
  • 0 likes
  • 2 in conversation