BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
GreyJoy
Obsidian | Level 7

My goal here is to have two PDF files, one with data and graphs that is safe to share with an external study team and another that is strictly for internal members. The one designated as internal (Unblinded/Closed) must be password protected incase it is accidently shared with the external team as a means of safeguarding data that should not be shared. 

 

The first sample of code does not work. The first PDF is created but the second PDF that is to be PW protected fails. Once I enter the PW to open the file the Adobe Acrobat error message of:

An error exists on this page. Acrobat may not display the page correctly. Please contact the person who created the PDF document to correct the problem.

The titles, dates and page numbers print but no graphs on any of the pages. Blank PDF.

%macro ReportPlots;
ods _all_ close ;
options pdfsecurity=none;
ods PDF file="U:\Projects\ICECAP\Programs\Greys_Code\Scheduled Programs\Funnels\OPEN\External QC Funnel Plots &asofdt..pdf"   ;

/*BLINDED SET OF GRAPHS*/

options pdfsecurity=low pdfpassword=(owner="Grey", open="Unlinded");
ods PDF file="U:\Projects\ICECAP\Programs\Greys_Code\Scheduled Programs\Funnels\CLOSED\Internal QC Funnel Plots &asofdt..pdf";

/*UNBLINDED GRAPHS*/

ods PDF close;
%mend;

%ReportPlots;

This next block of code works exactly as i would like it to. 2 files, one opens freely and the other PW protected, opens and displays all graphs.

 

 

options printerpath=pdf;
%macro ReportPlots;
ods _all_ close ;
options pdfsecurity=none;
ods printer file="U:\Projects\ICECAP\Programs\Greys_Code\Scheduled Programs\Funnels\OPEN\External QC Funnel Plots &asofdt..pdf"   ;

/*BLINDED SET OF GRAPHS*/

options pdfsecurity=low pdfpassword=(owner="Grey", open="Unlinded");
ods printer  file="U:\Projects\ICECAP\Programs\Greys_Code\Scheduled Programs\Funnels\CLOSED\Internal QC Funnel Plots &asofdt..pdf";

/*UNBLINDED GRAPHS*/

ods printer close;
%mend;

%ReportPlots;

 

My question is why? Why can I not us the ODS PDF statement and it work but I can assign the Printerpath as PDF and us the ODS PRINTER statement and it work fine?

 

I am using SAS enterprise guide 7.1 , Adobe Acrobate 2017 (well above the recommended version 5.0 in the SAS documentation) on the latest version of Windows10 64 bit. Any insight into this would be helpful.

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
GreyJoy
Obsidian | Level 7

I found the solution. Evidently, when producing output in a PDF format the normal ODS PDF options for security level and passwords work as expected when producing tables. 

 

However, when you are creating graphical output the missing piece to the puzzle is the device option below:

 

goptions device=SASPRTC;

 

After adding this before the creation of the file my passwords work and the file is created approximately. 

 

View solution in original post

3 REPLIES 3
ballardw
Super User

It is very likely that you are running into an issue about what is getting applied to the open ODS destinations when.

 

Did you try Closing the first ODS PDF before the OPTIONS for Pdfsecurity?

%macro ReportPlots;
ods _all_ close ;
options pdfsecurity=none;
ods PDF file="U:\Projects\ICECAP\Programs\Greys_Code\Scheduled Programs\Funnels\OPEN\External QC Funnel Plots &asofdt..pdf"   ;

/*BLINDED SET OF GRAPHS*/
ODS PDF CLOSE; /* CLOSE THE FILE BEFORE SETTING THE OPTIONS FOR THE NEXT SECTION*/

options pdfsecurity=low pdfpassword=(owner="Grey", open="Unlinded");
ods PDF file="U:\Projects\ICECAP\Programs\Greys_Code\Scheduled Programs\Funnels\CLOSED\Internal QC Funnel Plots &asofdt..pdf";

/*UNBLINDED GRAPHS*/

ods PDF close;
%mend;

 

There things in the backround that SAS does when multiple ODS destinations are open and I am think the timing of the switch to the new file might be problematic. At least this is easy to test.

 

GreyJoy
Obsidian | Level 7

I did try that. I looked at my code and thought keeping one output within a closed ods output statement would work but it still provided the same broken result. 

 

It looks cleaner and I think I will keep it that way in the working one going forward. 

GreyJoy
Obsidian | Level 7

I found the solution. Evidently, when producing output in a PDF format the normal ODS PDF options for security level and passwords work as expected when producing tables. 

 

However, when you are creating graphical output the missing piece to the puzzle is the device option below:

 

goptions device=SASPRTC;

 

After adding this before the creation of the file my passwords work and the file is created approximately. 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1674 views
  • 0 likes
  • 2 in conversation