BookmarkSubscribeRSS Feed
aaronbailey79
Fluorite | Level 6

I am using SAS studio, fully online.

 

In Scenario 4, to generate a pdf, I came up with this code which agrees with the solution:

 

proc sort data = cert.laguardia out = work.laguardia;
by dest;
run;
ods html close;
ods pdf file = 'LGA Airport' style=FestivalPrinter;
proc print data=work.laguardia;
title 'Laguardia Flights';
by dest;
run;
ods pdf close;

 

However, I cannot seem to actually create the pdf and get this message in the log:

 

ERROR: Insufficient authorization to access /pbr/biconfig/940/Lev1/SASApp/LGA Airport.

 

How do I view pdf output?

4 REPLIES 4
japelin
Rhodochrosite | Level 12

I was able to run it and get pdf file in SAS Studio in SAS on demand for Academics environment.


How about changing the ods pdf as follows

ods pdf file = 'LGA Airport.pdf' style=FestivalPrinter;

Or

ods pdf file = "%sysfunc(pathname(work))\LGA Airport.pdf" style=FestivalPrinter;

 

First, one point is to add the extension ".pdf".

If the problem is that you don't have access privileges, you can try to create it in the work library as in the latter case.

If you can't create it with this, then you have another problem.

Kurt_Bremser
Super User

Do not use just a filename in the ODS statement, use a fully qualified, absolute path.

The easiest way to do this is to prepend your home directory shortcut:

ods pdf file = '~/LGA_Airport.pdf' style=FestivalPrinter;

If you do not specify an absolute path, the file will be created in the current working directory of the SAS process, which is the application server root in SAS BI installations. And you do not have write permission there.

The newly created file will automatically appear in the Home folder in your navigation pane.

Out of long experience, I also recommend to not have blanks in filenames; operating systems see a blank as a word separator, and blanks make handling files from the commandline harder.

aaronbailey79
Fluorite | Level 6
Thank you! It worked like a charm.

I know it is good practice to not include spaces in file names, but that is
the filename that the question specified. Your solution also worked with a
space instead of _.
Cynthia_sas
SAS Super FREQ

Hi:
If you remember, in the Programming 1 class, we had students write their reports and ODS output into their output subfolder under the EPG1V2 or the EPG194 main folder. In this case, the absolute path would have been something like:
ods pdf file='/home/<yourUserID>/EPG1V2/output/myreport.pdf';
... more code...
ods pdf close;

or you can write to your WORK folder, but that is harder to find in order to download the file after it's created. Or you can write to your /home folder like this:
ods pdf file='/home/<yourUserID>/myreport.pdf';
... more code...
ods pdf close;
or
ods pdf file='~/myreport.pdf';
... more code...
ods pdf close;

Remember that on the SAS OnDemand server the tilde (~) is a placeholder for your home folder. If you do not use an absolute path or the tilde in your path, then SAS tries to write to a server folder where you do not have write access so you'll generate an error message with a relative file reference.

 

Hope this helps,
Cynthia

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 4 replies
  • 676 views
  • 0 likes
  • 4 in conversation