BookmarkSubscribeRSS Feed
RussellAlmeida
Calcite | Level 5
Hi,

I have a sorted dataset and am using the sorted fields in the #byval1-6 in the title, All the variables in the BYVAL are same except variable 6 which sometimes changes. I have approx 10 records and would like to print them in the single page by just adding a blank line if the value of the BY variable changes instead of going to the next page.

Version: SAS 9.1.3
OS : AIX
ODS PDF

Regards
Russell
4 REPLIES 4
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
My initial response is to suggest that you have total control with DATA step report generation.

Scott Barry
SBBWorks, Inc.


Google advanced search argument to consider using:

data step programming report site:sas.com
Cynthia_sas
SAS Super FREQ
Hi:
In addition to Scott's suggestion, PROC REPORT allows you to do something similar to BY processing via the use of BREAK processing on GROUP or ORDER variables. You can have a LINE statement write out a blank line when the value of a GROUP or ORDER variable (similar to your BY variable) changes.

The syntax would be something like (note untested code...not at my computer):
[pre]
ods pdf file='c:\temp\testbr.pdf';

proc report data=sashelp.class nowd;
title 'List of Students and Averages for Age, Height and Weight by Gender';
column sex name age height weight;
define sex / order;
define name / order;
define age / mean;
define height / mean;
define weight / mean;
break after sex / summarize;
compute after sex;
line ' ';
end;
run;

ods pdf close;
[/pre]

cynthia
Peter_C
Rhodochrosite | Level 12
Russel

have you seen the layout PROC PRINT provides when the ID variable list starts with all the BY variables?
For example[pre]proc sort data= sashelp.class(obs=6) out= class ;
by sex age ;
run ;
proc print ;
by sex ;
id sex age ;
var name height ;
run ;[/pre]The procedure inserts a blank line before each by-group[pre]The SAS System

Sex Age Name Height

F 13 Alice 56.5
13 Barbara 65.3
14 Carol 62.8

M 12 James 57.3
14 Alfred 69.0
14 Henry 63.5
[/pre]There are your blank lines between by-groups.
In the PDF destination you still get page breaks while you use the NOBYLINE option. I hope with this style of ID/BY combination you might feel comfortable using PROC PRINT without the NOBYLINE option.

PeterC punctuation helps, even when late 😉 Message was edited by: Peter.C
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Here's a conference paper demonstrating how a PROC REPORT output can be customized and then generated with a DATA _NULL_ step:

http://www2.sas.com/proceedings/sugi25/25/ad/25p032.pdf

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search for this topic:

proc report customized pagination site:sas.com

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
  • 1629 views
  • 0 likes
  • 4 in conversation