Help using Base SAS procedures

Suppress “By” variable from output of PROC PRINT

Reply
N/A
Posts: 0

Suppress “By” variable from output of PROC PRINT

I am creating a report that has page breaks by “Year”, and summing several amounts. When I use both the BY and SUM statements, the report has the correct page breaks and the column sums are fine, but I would like to remove (suppress) the BY variable that always appears under the first column (underlined) in my output report. I have included some example code below that will produce the report in the format I want, but would like to suppress the text "YEAR" that appears underlined under column for "Var1".


data File1;
input
@001 Var1 $ 1.
@002 Var2 $ 8.
@011 Var3 $ 3.
@015 Year $ 4.
@020 Amt1 D5.2
@026 Amt2 D5.2
;
datalines;
234567856 A13 1997 12465 58493
417485930 N13 2005 73464 48976
428748594 L01 1998 56456 00456
222211111 L01 2005 45578 03405
254323454 P14 2005 00345 39403
200203945 Q11 1997 64532 44444
200456432 J45 1998 13456 09887
413456654 P12 2005 54565 23456
;
run;
proc sort data=File1;
by year;
run;
proc print Data=File1 UNIFORM noobs label;
OPTIONS CENTER NODATE PAGENO=1 nobyline ;
title1 'Page Break Report Example';
Title2 'Year = #BYVAL(year)';
format amt1 dollar10.2
amt2 dollar10.2
;
by year;
sum amt1 amt2;
run;
Super Contributor
Super Contributor
Posts: 3,174

Re: Suppress “By” variable from output of PROC PRINT

The new PROC PRINT option SUMLABEL with SAS 9.2 allows more control over the label of the SUM total row. Otherwise, you may have to consider PROC REPORT as an alternative approach, possibly.

Scott Barry
SBBWorks, Inc.
SAS Employee
Posts: 160

Re: Suppress “By” variable from output of PROC PRINT

Ask a Question
Discussion stats
  • 2 replies
  • 102 views
  • 0 likes
  • 3 in conversation