Problem Note 1740: #BYVAL used in conjunction with PROC PRINT generates an incorrect title
When using ODS HTML, PRINTER, or RTF to route PROC PRINT output, the first title will display "Title text #byval(var)" regardless of the value of the BYLINE system option. If the BYLINE system option is set, the traditional output (the Output window or the Listing file) will display similar behavior.
The best workaround for correcting the HTML/RTF/PRINTER output is to use PROC REPORT or use the macro language and issue one PROC PRINT per BY group (see the sample code below). For traditional output, set the NOBYLINE system option.
data new;
input a $ b c;
datalines;
1 4 6
1 2 3
2 3 4
2 3 5
;
run;
/* This creates a macro variable for every */
/* value of A as well as a counter variable */
data _null_;
retain count 0;
set new;
by a;
if first.a then do;
count+1;
call symput('val'||left(count),trim(left(a)));
end;
call symput('last',left(count));
run;
options mprint;
%macro test;
/* This %DO loop performs one PROC PRINT */
/* for every value of A */
%do i = 1 %to &last;
proc print data=new;
where a="&&val&i"; /* no quotes used if A is numeric */
title "This is the value of A: &&val&i";
run;
%end;
%mend test;
/* This step calls the macro */
%test
Operating System and Release Information
SAS System | Base SAS | Microsoft Windows XP Professional | 8.2 TS2M0 | 9 TS M0 |
Microsoft Windows NT Workstation | 8 TS M0 | 9 |
Solaris | 8 TS M0 | |
OpenVMS VAX | 8 TS M0 | |
Windows Millennium Edition (Me) | 8.2 TS2M0 | |
Microsoft Windows 95/98 | 8 TS M0 | |
64-bit Enabled Solaris | 8 TS M0 | |
z/OS | 8 TS M0 | 9 TS M0 |
OS/2 | 8 TS M0 | |
CMS | 8 TS M0 | |
64-bit Enabled HP-UX | 8 TS M0 | |
HP-UX | 8 TS M0 | |
Linux | 8.2 TS2M0 | 9 TS M0 |
OpenVMS Alpha | 8 TS M0 | 9 TS M0 |
64-bit Enabled AIX | 8 TS M0 | |
AIX | 8 TS M0 | |
Tru64 UNIX | 8 TS M0 | 9 TS M0 |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
#BYVAL used in conjunction with PROC PRINT generates an incorrect title.
Type: | Problem Note |
Priority: | medium |
Topic: | SAS Reference ==> Procedures ==> PRINT
|
Date Modified: | 2002-01-04 15:14:05 |
Date Created: | 2000-02-28 11:06:07 |