BookmarkSubscribeRSS Feed
aravind
Fluorite | Level 6
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
2 REPLIES 2
Cynthia_sas
Diamond | Level 26
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
Ksharp
Super User
[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

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 1107 views
  • 0 likes
  • 3 in conversation