Hi, novice SAS user here. I am used to coding for SAS 9.3 and have used my same code for several data sets without a problem until we upgraded to 9.4 and now I get this error, "Cannot write image to ____.png Please ensure that proper disk permissions are set." for every procedure that involves graphs/charts. I understand this has to do with an ods output error..I changed it to ods html close; ods listing; and then my procedures. How can I change the output to give me my graphs/charts? Any direction is helpful, thanks!
Have a look at SAS Usage Note 49421 - A "Cannot write image" error might occur with ODS Graphics and the SAS/GRAPH®...
You need to specify a location in your ODS statements to point to a directory where you have write permissions. Without this it will be attempting to write to the default directory, which for a shared SAS platform environment will be the application servers configuration directory (e.g. /opt/sas/config/Lev1/SASApp).
I know it probably doesn't sound like it, but in a way it's good that you are getting this error. It suggests that file system permissions on your SAS server might have been configured well. Without them the SASApp directory can get littered with lots of temporary files.
Post some code and the actual error from the log.
Did you by any chance upgrade to 9.4 to a server version from a stand-alone version for 9.3? If that is the case then the paths to your output might be trying to write to a server where you do not have permissions.
Yes, I went from my personal use to one used on remote software (server).... Code is for a multiple linear regression, here is part of it:
ods html close;
ods listing;
data hemoSAS;
input hemoglobin cancer gender age @@;
cards;
*Data set*
;
proc sgscatter data=hemoSAS;
matrix cancer gender age;
run;
proc reg data=hemoSAS;
model hemoglobin = cancer gender age;
output out=diag r=resid p=pred;
run;
*continues..*
Log output:
ods html close;
72 ods listing;
73 data hemoSAS;
74 input hemoglobin cancer gender age @@;
75 cards;
NOTE: SAS went to a new line when INPUT statement reached past the end of a line.
NOTE: The data set WORK.HEMOSAS has 27 observations and 4 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
103 ;
104 proc sgscatter data=hemoSAS;
105 matrix cancer gender age;
106 run;
NOTE: PROCEDURE SGSCATTER used (Total process time):
real time 0.54 seconds
cpu time 0.14 seconds
ERROR: Cannot write image to SGScatter.png. Please ensure that proper disk permissions are set.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 27 observations read from the data set WORK.HEMOSAS.
You'll have to specify a destination back to your machine or to an acceptable location on the server.
Thanks! I have never had to complete this before, do you have a suggested start code that I can use and then link it to a file on one of my drives? Thanks!
Have a look at SAS Usage Note 49421 - A "Cannot write image" error might occur with ODS Graphics and the SAS/GRAPH®...
You need to specify a location in your ODS statements to point to a directory where you have write permissions. Without this it will be attempting to write to the default directory, which for a shared SAS platform environment will be the application servers configuration directory (e.g. /opt/sas/config/Lev1/SASApp).
I know it probably doesn't sound like it, but in a way it's good that you are getting this error. It suggests that file system permissions on your SAS server might have been configured well. Without them the SASApp directory can get littered with lots of temporary files.
Paul- Thank you! Wish I had seen this article before I asked again. Thanks for the advice and I will try this out tomorrow during my next attempts. I do indeed believe this error began due to a switch from a stand-alone to a server use. Always great to learn more about SAS. Thank you both for your help!
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.