The SAS Output Delivery System and reporting techniques

Proc Report Question with GROUPS

Reply
Contributor
Posts: 21

Proc Report Question with GROUPS

hi there,

I have the following sample dataset.

Age ID FIRSTNAME LASTNAME
------------------------------------------------------------------
10 100 FNAME1 LNAME1
10 200 FNAME2 LNAME2
10 300 FNAME3 LNAME3
20 400 FNAME4 LNAME4
20 500 FNAME5 LNAME5
------------------------------------------------------------------

I am trying to create the following report.


REPORT TITLE

AGE: 10

ID FIRSTNAME LASTNAME
--------------------------------------------------------------
100 FNAME1 LNAME1
200 FNAME2 LNAME2
300 FNAME3 LNAME3

TOTAL NUMBER OF IDS: 3

AGE: 20

ID FIRSTNAME LASTNAME
---------------------------------------------------------
400 FNAME1 LNAME1
500 FNAME2 LNAME2

TOTAL NUMBER OF IDS: 2

GRAND TOTAL NUMBER OF IDS: 5

---------END OF REPORT--------

I've got the solution in data null in ODS PDF Destination but i am
trying to do it in PROC REPORT using PDF Destination.
I want to know whether we can do this kinda report in Proc report or not.
IF yes i would like to see how we can do it.

Help will be Appreciated.

Thanks
Aravind
SAS Super FREQ
Posts: 8,866

Re: Proc Report Question with GROUPS

Hi:
This previous posting:
http://support.sas.com/forums/message.jspa?messageID=53453#53453

still has good information to answer your question. What you want to do is possible with PROC REPORT. There are techniques in this paper also,
http://support.sas.com/rnd/papers/sgf07/sgf2007-report.pdf (original paper)
http://support.sas.com/resources/papers/proceedings11/246-2011.pdf (updated for 9.2)

that show how to write customized break lines -- you will either use a LINE statement or you will create an "extra" breaking variable to do it.

cynthia
Super User
Posts: 10,035

Re: Proc Report Question with GROUPS

[pre]
data temp;
title='REPORT TITLE';
run;

data want;
input Age ID FIRSTNAME $ LASTNAME $;
datalines;
10 100 FNAME1 LNAME1
10 200 FNAME2 LNAME2
10 300 FNAME3 LNAME3
20 400 FNAME4 LNAME4
20 500 FNAME5 LNAME5
;
run;


options nodate nonumber;
title ' ';
ods pdf file='c:\x.pdf' uniform startpage=never;
proc report data=temp style={frame=void rules=none } noheader nowd;
column title;
define title/style={font_size=50px font_weight=bold};
run;
proc report data=want nowd style=sasweb noheader;
column age id firstname lastname n;
define age/group noprint;
define id/style={just=left};
define firstname /style={just=right};
define lastname /style={just=right};
define n/noprint;
compute before age/style={just=left};
line 'AGE:' age best2. ;
line @1 'ID' @24 'FIRSTNAME' @44 'LASTNAME' ;
line 60*'-';
endcomp;
compute after age/style={just=left};
line 'TOTAL NUMBER OF IDS:' n best4.;
line ' ';
endcomp;
compute after/style={just=left};
line '----------END OF REPORT------------';
endcomp;
run;


ods pdf close;

[/pre]




Ksharp Message was edited by: Ksharp
Ask a Question
Discussion stats
  • 2 replies
  • 150 views
  • 0 likes
  • 3 in conversation