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
SAS Super FREQ
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

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!

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