BookmarkSubscribeRSS Feed
BigPete
Obsidian | Level 7

Every time I use ODS PDF, the PDF file always come out with tab name called "SAS System Output". Is there a way in SAS code to customize PDF tab names?

 

BigPete_0-1654269931713.png

 

10 REPLIES 10
ballardw
Super User

Show some code on how you create those PDF documents.

 

 

BigPete
Obsidian | Level 7

@ballardw let's try same code from a recent posting although it seems the default tab name is always "SAS System Output" as long as ODS PDF is involved: https://communities.sas.com/t5/ODS-and-Base-Reporting/Second-line-issue-using-STARTPAGE-and-ODS-TAGS...

 

Any more helpful?

Tom
Super User Tom
Super User

What is a "tab name"?  When I look at a PDF file the viewer shows me the NAME of the file.

ods pdf file='c:\downloads\test.pdf'  ;
proc print data=sashelp.class;
run;
ods pdf close;

In this case test.pdf is the filename.

Tom_0-1654617864802.png

Or are you just asking how to change the TITLE that appears inside the PDF file?

Use the TITLE statement.

 

BigPete
Obsidian | Level 7

Somehow it shows "SAS System Output" when using PROC REPORT from my end even though the file is called test.pdf

 

BigPete_0-1654618908276.png

Tom
Super User Tom
Super User

@BigPete wrote:

Somehow it shows "SAS System Output" when using PROC REPORT from my end even though the file is called test.pdf

 

BigPete_0-1654618908276.png


What program did you run?  Did you use an explicit ODS PDF statement with the FILE= option?

 

What program is it that you have taken the screen shot of?

I thought perhaps that whatever PDF viewer tool you are using is showing the PDF files internal metadata instead of the actual filename.  But it does not look like SAS is inserting anything into that metadata.  At least it didn't for the code I ran.

Tom_0-1654619815172.png

 

 

ballardw
Super User

Since @Tom shows a picture very similar to yours and the code that generates it showing the "tab" and different text in both the positions you circle then obviously those bits change. And they change with the code submitted. Which is why we ask for YOUR code. If you use a wizard or task to generate the output there should still be code generated and shown in the LOG. Which may mean that you not using the option to name the file.

BigPete
Obsidian | Level 7

I can see that it can be fixed through "Document Properties" in Adobe. You pretty much see my whole sample code in https://communities.sas.com/t5/ODS-and-Base-Reporting/Second-line-issue-using-STARTPAGE-and-ODS-TAGS.... Except that instead of ODS TAGSETS.RTF, I used 'ods pdf FILE = "C:\Users\Johnny\test.pdf" STYLE=BARRETTSBLUE;'. @ballardw was this "the option to name the file" you're referring to?

ballardw
Super User

@BigPete wrote:

I can see that it can be fixed through "Document Properties" in Adobe. You pretty much see my whole sample code in https://communities.sas.com/t5/ODS-and-Base-Reporting/Second-line-issue-using-STARTPAGE-and-ODS-TAGS.... Except that instead of ODS TAGSETS.RTF, I used 'ods pdf FILE = "C:\Users\Johnny\test.pdf" STYLE=BARRETTSBLUE;'. @ballardw was this "the option to name the file" you're referring to?


Yes that sort of file name.

It may be time to show the LOG and possibly some details of your SAS environment such as which version of SAS and the interface.

My stand-alone SAS 9.4 does not generate PDF files displaying "SAS Output". It shows the name of the file in the Adobe application in both places you have circled as does Toms.

BigPete
Obsidian | Level 7

BigPete_0-1654632378942.png

 

%let dir=C:\Users\Johnny;

proc import datafile="&dir\grades.xlsx"
			out=grades
			replace;
run;

ODS LISTING CLOSE;

OPTIONS NODATE
		NONUMBER
		TOPMARGIN	=0.5IN 
		LEFTMARGIN	=0.5IN
		RIGHTMARGIN =0.5IN
		BOTTOMMARGIN=0.5IN;

ods noptitle;
ods pdf FILE = "&dir\test.pdf" accessible STYLE=BARRETTSBLUE;

ods proclabel='Frequencies';

ODS ESCAPECHAR = '^';

ODS pdf TEXT = "^{STYLE[FONTSIZE=10.5pt JUST=L fontweight=bold]QUIZ}";
ODS pdf TEXT = " ";

PROC REPORT DATA = grades MISSING STYLE(REPORT)=[/*width=100%*/ BACKGROUND=WHITE BORDERCOLOR=WHITE BORDERWIDTH=0 ASIS=OFF FONTSIZE=2 just=l] NOWD contents="quiz: &vlabel";

COLUMN quiz quiz=vallabel DUMROW N PCTN;

COMPUTE quiz;
	COUNT+1;
/*	IF (MOD(COUNT,2)) THEN DO;*/
/*	CALL DEFINE (_ROW_, 'STYLE', 'STYLE=[BACKGROUND=WHITE]');*/
/*	END;*/
  if (mod(count,2))=0 then call define(_row_, 'STYLE', 'STYLE=[BACKGROUND=WHITE]');
ENDCOMP;

DEFINE quiz	/"Value" GROUP ORDER=INTERNAL	STYLE(COLUMN)=[WIDTH=10% JUST=C FONTSIZE=2]	STYLE(HEADER)=[JUST=C FONTSIZE=2]	;
DEFINE vallabel	/"Label" GROUP ID				STYLE(COLUMN)=[WIDTH=60% JUST=L FONTSIZE=2]	STYLE(HEADER)=[JUST=L FONTSIZE=2] format=1.	NOPRINT	;
DEFINE DUMROW	/COMPUTED "Label"				STYLE(COLUMN)=[WIDTH=60% JUST=L FONTSIZE=2]	STYLE(HEADER)=[JUST=L FONTSIZE=2]	width=65;
DEFINE N 		/"Frequency"			STYLE(COLUMN)=[WIDTH=15% JUST=R FONTSIZE=2]	STYLE(HEADER)=[JUST=R FONTSIZE=2]	FORMAT=COMMA12.			;
DEFINE PCTN		/"%"							STYLE(COLUMN)=[WIDTH=10% JUST=R FONTSIZE=2]	STYLE(HEADER)=[JUST=R FONTSIZE=2]	FORMAT=PERCENT7.1		;

COMPUTE DUMROW /CHAR LENGTH = 65;
	IF _BREAK_="_RBREAK_" THEN DO DUMROW = 'Total';
	END;
	ELSE DUMROW=PUT(vallabel, 1.);
	IF DUMROW = 'Total' THEN CALL DEFINE (_ROW_, 'STYLE', "STYLE=[BACKGROUND=LIGHT GRAY FONTSTYLE=ITALIC FONTSIZE=2]");
ENDCOMP;

RBREAK AFTER / SUMMARIZE;

RUN;

ODS pdf TEXT = " ";
ODS pdf TEXT = "AND THAT'S A WRAP FOR QUIZZES";
ods startpage=now;



ODS pdf TEXT = "^{sectd}^{STYLE[FONTSIZE=10.5pt JUST=L fontweight=bold]GRADE}";
ODS pdf TEXT = " ";

PROC REPORT DATA = grades MISSING STYLE(REPORT)=[width=100% BACKGROUND=WHITE BORDERCOLOR=WHITE BORDERWIDTH=0 ASIS=OFF FONTSIZE=2] NOWD contents="GRADE: &vlabel";

COLUMN GRADE GRADE=vallabel DUMROW N PCTN;

COMPUTE GRADE;
	COUNT+1;
/*	IF (MOD(COUNT,2)) THEN DO;*/
/*	CALL DEFINE (_ROW_, 'STYLE', 'STYLE=[BACKGROUND=WHITE]');*/
/*	END;*/
  if (mod(count,2))=0 then call define(_row_, 'STYLE', 'STYLE=[BACKGROUND=WHITE]');
ENDCOMP;

DEFINE GRADE	/"Value" GROUP ORDER=INTERNAL	STYLE(COLUMN)=[WIDTH=10% JUST=C FONTSIZE=2]	STYLE(HEADER)=[JUST=C FONTSIZE=2]	;
DEFINE vallabel	/"Label" GROUP ID				STYLE(COLUMN)=[WIDTH=60% JUST=L FONTSIZE=2]	STYLE(HEADER)=[JUST=L FONTSIZE=2] format=$1.	NOPRINT	;
DEFINE DUMROW	/COMPUTED "Label"				STYLE(COLUMN)=[WIDTH=60% JUST=L FONTSIZE=2]	STYLE(HEADER)=[JUST=L FONTSIZE=2]	width=65;
DEFINE N 		/"Frequency"			STYLE(COLUMN)=[WIDTH=15% JUST=R FONTSIZE=2]	STYLE(HEADER)=[JUST=R FONTSIZE=2]	FORMAT=COMMA12.			;
DEFINE PCTN		/"%"							STYLE(COLUMN)=[WIDTH=10% JUST=R FONTSIZE=2]	STYLE(HEADER)=[JUST=R FONTSIZE=2]	FORMAT=PERCENT7.1		;

COMPUTE DUMROW /CHAR LENGTH = 65;
	IF _BREAK_="_RBREAK_" THEN DO DUMROW = 'Total';
	END;
	ELSE DUMROW=PUT(vallabel, $1.);
	IF DUMROW = 'Total' THEN CALL DEFINE (_ROW_, 'STYLE', "STYLE=[BACKGROUND=LIGHT GRAY FONTSTYLE=ITALIC FONTSIZE=2]");
ENDCOMP;

RBREAK AFTER / SUMMARIZE;

RUN;

ODS pdf TEXT = " ";
ODS pdf TEXT = "AND THAT'S A WRAP FOR GRADES";
ods startpage=now;

quit;
title;
ODS _all_ CLOSE;

1
2 %let dir=C:\Users\Johnny;
3
4 proc import datafile="&dir\grades.xlsx"
5 out=grades
6 replace;
7 run;

NOTE: WORK.GRADES data set was successfully created.
NOTE: The data set WORK.GRADES has 12 observations and 3 variables.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.86 seconds
cpu time 0.32 seconds


8
9 ODS LISTING CLOSE;
10
11 OPTIONS NODATE
12 NONUMBER
13 TOPMARGIN =0.5IN
14 LEFTMARGIN =0.5IN
15 RIGHTMARGIN =0.5IN
16 BOTTOMMARGIN=0.5IN;
17
18 ods noptitle;
19 ods pdf FILE = "&dir\test.pdf" accessible STYLE=BARRETTSBLUE;
NOTE: Writing ODS PDF output to DISK destination
"C:\Users\Johnny\test.pdf", printer "PDFUA".
20
21 ods proclabel='Frequencies';
22
23 ODS ESCAPECHAR = '^';
24
25 ODS pdf TEXT = "^{STYLE[FONTSIZE=10.5pt JUST=L fontweight=bold]QUIZ}";
26 ODS pdf TEXT = " ";
27
28 PROC REPORT DATA = grades MISSING STYLE(REPORT)=[/*width=100%*/ BACKGROUND=WHITE
28 ! BORDERCOLOR=WHITE BORDERWIDTH=0 ASIS=OFF FONTSIZE=2 just=l] NOWD contents="quiz:
28 ! &vlabel";
NOTE: Writing HTML Body file: sashtml.htm
WARNING: Apparent symbolic reference VLABEL not resolved.
29
30 COLUMN quiz quiz=vallabel DUMROW N PCTN;
31
32 COMPUTE quiz;
33 COUNT+1;
34 /* IF (MOD(COUNT,2)) THEN DO;*/
35 /* CALL DEFINE (_ROW_, 'STYLE', 'STYLE=[BACKGROUND=WHITE]');*/
36 /* END;*/
37 if (mod(count,2))=0 then call define(_row_, 'STYLE', 'STYLE=[BACKGROUND=WHITE]');
38 ENDCOMP;
39
40 DEFINE quiz /"Value" GROUP ORDER=INTERNAL STYLE(COLUMN)=[WIDTH=10% JUST=C
40 ! FONTSIZE=2] STYLE(HEADER)=[JUST=C FONTSIZE=2] ;
41 DEFINE vallabel /"Label" GROUP ID STYLE(COLUMN)=[WIDTH=60% JUST=L
41 ! FONTSIZE=2] STYLE(HEADER)=[JUST=L FONTSIZE=2] format=1. NOPRINT ;
42 DEFINE DUMROW /COMPUTED "Label" STYLE(COLUMN)=[WIDTH=60% JUST=L
42 ! FONTSIZE=2] STYLE(HEADER)=[JUST=L FONTSIZE=2] width=65;
43 DEFINE N /"Frequency" STYLE(COLUMN)=[WIDTH=15% JUST=R FONTSIZE=2]
43 ! STYLE(HEADER)=[JUST=R FONTSIZE=2] FORMAT=COMMA12. ;
44 DEFINE PCTN /"%" STYLE(COLUMN)=[WIDTH=10% JUST=R
44 ! FONTSIZE=2] STYLE(HEADER)=[JUST=R FONTSIZE=2] FORMAT=PERCENT7.1 ;
45
46 COMPUTE DUMROW /CHAR LENGTH = 65;
47 IF _BREAK_="_RBREAK_" THEN DO DUMROW = 'Total';
48 END;
49 ELSE DUMROW=PUT(vallabel, 1.);
50 IF DUMROW = 'Total' THEN CALL DEFINE (_ROW_, 'STYLE', "STYLE=[BACKGROUND=LIGHT
50 ! GRAY FONTSTYLE=ITALIC FONTSIZE=2]");
51 ENDCOMP;
52
53 RBREAK AFTER / SUMMARIZE;
54
55 RUN;

NOTE: There were 12 observations read from the data set WORK.GRADES.
NOTE: At least one W.D format was too small for the number to be printed. The decimal
may be shifted by the "BEST" format.
NOTE: PROCEDURE REPORT used (Total process time):
real time 0.39 seconds
cpu time 0.18 seconds


56
57 ODS pdf TEXT = " ";
58 ODS pdf TEXT = "AND THAT'S A WRAP FOR QUIZZES";
59 ods startpage=now;
60
61
62
63 ODS pdf TEXT = "^{sectd}^{STYLE[FONTSIZE=10.5pt JUST=L fontweight=bold]GRADE}";
64 ODS pdf TEXT = " ";
65
66 PROC REPORT DATA = grades MISSING STYLE(REPORT)=[width=100% BACKGROUND=WHITE
66 ! BORDERCOLOR=WHITE BORDERWIDTH=0 ASIS=OFF FONTSIZE=2] NOWD contents="GRADE: &vlabel";
WARNING: Apparent symbolic reference VLABEL not resolved.
67
68 COLUMN GRADE GRADE=vallabel DUMROW N PCTN;
69
70 COMPUTE GRADE;
71 COUNT+1;
72 /* IF (MOD(COUNT,2)) THEN DO;*/
73 /* CALL DEFINE (_ROW_, 'STYLE', 'STYLE=[BACKGROUND=WHITE]');*/
74 /* END;*/
75 if (mod(count,2))=0 then call define(_row_, 'STYLE', 'STYLE=[BACKGROUND=WHITE]');
76 ENDCOMP;
77
78 DEFINE GRADE /"Value" GROUP ORDER=INTERNAL STYLE(COLUMN)=[WIDTH=10% JUST=C
78 ! FONTSIZE=2] STYLE(HEADER)=[JUST=C FONTSIZE=2] ;
79 DEFINE vallabel /"Label" GROUP ID STYLE(COLUMN)=[WIDTH=60% JUST=L
79 ! FONTSIZE=2] STYLE(HEADER)=[JUST=L FONTSIZE=2] format=$1. NOPRINT ;
80 DEFINE DUMROW /COMPUTED "Label" STYLE(COLUMN)=[WIDTH=60% JUST=L
80 ! FONTSIZE=2] STYLE(HEADER)=[JUST=L FONTSIZE=2] width=65;
81 DEFINE N /"Frequency" STYLE(COLUMN)=[WIDTH=15% JUST=R FONTSIZE=2]
81 ! STYLE(HEADER)=[JUST=R FONTSIZE=2] FORMAT=COMMA12. ;
82 DEFINE PCTN /"%" STYLE(COLUMN)=[WIDTH=10% JUST=R
82 ! FONTSIZE=2] STYLE(HEADER)=[JUST=R FONTSIZE=2] FORMAT=PERCENT7.1 ;
83
84 COMPUTE DUMROW /CHAR LENGTH = 65;
85 IF _BREAK_="_RBREAK_" THEN DO DUMROW = 'Total';
86 END;
87 ELSE DUMROW=PUT(vallabel, $1.);
88 IF DUMROW = 'Total' THEN CALL DEFINE (_ROW_, 'STYLE', "STYLE=[BACKGROUND=LIGHT
88 ! GRAY FONTSTYLE=ITALIC FONTSIZE=2]");
89 ENDCOMP;
90
91 RBREAK AFTER / SUMMARIZE;
92
93 RUN;

NOTE: There were 12 observations read from the data set WORK.GRADES.
NOTE: At least one W.D format was too small for the number to be printed. The decimal
may be shifted by the "BEST" format.
NOTE: PROCEDURE REPORT used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds


94
95 ODS pdf TEXT = " ";
96 ODS pdf TEXT = "AND THAT'S A WRAP FOR GRADES";
97 ods startpage=now;
98
99 quit;
100 title;
101 ODS _all_ CLOSE;
NOTE: ODS PDF printed 2 pages to C:\Users\Johnny\test.pdf.

 

Tom
Super User Tom
Super User

Try using a different reader.

Tom_0-1654632785529.png

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 10 replies
  • 1191 views
  • 0 likes
  • 3 in conversation