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. 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

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
  • 3 replies
  • 880 views
  • 0 likes
  • 2 in conversation