BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
hswdl01
Fluorite | Level 6

I am trying to create a PDF file using ODS PDF however, I keep getting an error that the physical file does not exist. It needs to include three pages for ChiSquare results, a bar chart, and the ANOVA results. However, I'm not sure what in my code is causing this error:

ODS PDF FILE = '&CourseRoot/Hypertension Study/Documents/Analysis Report-Hypertension Study.pdf';


*	display the results of the Chi-Square test   *;
TITLE1		'Chi-Square Test of Independence Results';
FOOTNOTE	"Created by HS";
PROC REPORT DATA = ChiSqResults;
COLUMN	Test 
		("Statistical Results" DF Value Prob);
	LABEL Prob = 'P-Value';
	
	RUN;

*	include the figure in the report   *;
PROC DATASETS Lib = ;
	MODIFY	StatePercents;
	FORMAT	ColPercent;
	RUN;
	QUIT;
TITLE1 BOLD 'Hypertension-Related Death Rates by State';
FOOTNOTE1	'Created by HS';
PROC SGPLOT DATA = StatePercents;
	REFLINE 1.8
		/	AXIS		= Y
			LABEL		= 'National Average = 1.8'
			LABELLOC	= INSIDE
			LABELPOS	= MAX
			LINEATTRS	= (	COLOR		= INDIGO
							PATTERN 	= SHORTDASH
							THICKNESS	= 1);
	VBAR	StateCd / RESPONSE = ColPercent
			DATALABEL
			FILLATTRS	= (	COLOR	= LIGHTSALMON);
	XAXIS	LABELATTRS	= (	WEIGHT	= BOLD);
	YAXIS	VALUES		= (0 1 2 3 4)
			LABEL		= 'Percent'
			LABELATTRS	= (	WEIGHT 	= BOLD)
			OFFSETMIN	= 0
			GRID;
	FORMAT	StateCd $StateCd.;
	RUN;
TITLE;
FOOTNOTE;


*	include the 4 ANOVA results   *;
PROC PRINT DATA = ANOVAResults;
	RUN;


ODS PDF CLOSE;

This is the error I keep receiving:

ERROR: Physical file does not exist, /pbr/biconfig/940/Lev1/SASApp/&CourseRoot/Documents/Analysis Report-Hypertension Study.pdf.
1 ACCEPTED SOLUTION

Accepted Solutions
camdbean
Fluorite | Level 6
Hello,
I had this same issue as well, when you used the macro &CourseRoot to provide a file pathway in your ODS PDF statement, you have to make sure you enclose your file path in double quotes (" ") rather than single quotes (' ') as when referencing other macro variables. After i changed this I was able to get it to work for my project.

I hope this helps!

View solution in original post

2 REPLIES 2
camdbean
Fluorite | Level 6
Hello,
I had this same issue as well, when you used the macro &CourseRoot to provide a file pathway in your ODS PDF statement, you have to make sure you enclose your file path in double quotes (" ") rather than single quotes (' ') as when referencing other macro variables. After i changed this I was able to get it to work for my project.

I hope this helps!
hswdl01
Fluorite | Level 6

Thank you!

Just ran it again with that adjustment and it worked!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 680 views
  • 1 like
  • 2 in conversation