BookmarkSubscribeRSS Feed
G_I_Jeff
Obsidian | Level 7

Trying to create a simple pdf with the following starting code:

ODS _ALL_ CLOSE;                                               
ODS PDF FILE="/home/seb/dm1307/tmp/nfc.pdf" STYLE=SASWEB NOTOC;
RUN;                                                           

I get simple ERROR: .  message.

 

The directory exists, not root, my id as the owning id and permissions set to 777.

What am I missing?

3 REPLIES 3
ballardw
Super User

Two things are missing from your "code".

First, you do not show any procedure or process that would write to the ODS destination.

 

Second, until the ODS PDF CLOSE; statement is executed then the file is open for writing and is not complete.

Below is a procedure that will write to the destination and a close.

ODS PDF FILE="/home/seb/dm1307/tmp/nfc.pdf" STYLE=SASWEB NOTOC;
proc print data=sashelp.class; RUN;
ods pdf close;

 

What did your LOG look like?

 

Abbreviating your code too much will often hide the actual issues. When you have problems the LOG is often what we need to see because it will have messages like "file doesn't exist"

 

 

G_I_Jeff
Obsidian | Level 7

ballardw

 

Here is the complete code I'm trying. I added the first couple of statements simply because that is where it is failing.

ODS _ALL_ CLOSE;                                               
ODS PDF FILE="/home/seb/dm1307/tmp/nfc.pdf" STYLE=SASWEB NOTOC;
RUN;                                                           
                                                               
PROC SQL;                                                      
 SELECT SYSTEM,                                                
        DATE,                                                  
        AVG(PCTZIPBY) AS AVGZIP                                
   FROM USER.RMFINTRV                                          
  GROUP BY SYSTEM, DATE;                                       
QUIT;                                                          
                                                               
ODS _ALL_ CLOSE;                                               
ODS LISTING;                                                   
RUN;                                                           

I can run this same code on another system and it does work. I'm assuming this is just a permission issue with the directory. Or does the pdf have to exist? Again, assuming this statement creates the pdf if it does not exist, or replaces if does.

This is all I'm getting in my SASLOG:

1                                                                         
2          ODS _ALL_ CLOSE;                                               
3          ODS PDF FILE="/home/seb/dm1307/tmp/nfc.pdf" STYLE=SASWEB NOTOC;
ERROR: .                                                                  
4          RUN;                                                           
5                                                                         
6          PROC SQL;                                                      
                                                                          
ERROR: SAS ended due to errors.                                           
       You specified: OPTIONS ERRORABEND;.                                
ERROR: Errors printed on page 3.                                          

Can I run OPTIONS on the code to possibly point to the error?

ballardw
Super User

RUN belongs at the end of a procedure or data step. When it appears in code without a procedure then odd things might happen depending on the last statements encountered.

 

You may want to use the Options to turn off ErrorAbend so your SAS session isn't terminated when you make minor errors.

 

Options noerrorabend;

 

In my opinion about the only time errorabend should be on is in the case of production batch jobs so that something like a missing file doesn't create a lot of headaches.

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1642 views
  • 0 likes
  • 2 in conversation