BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
mona4u
Lapis Lazuli | Level 10

Hi all, 

I want to output different data to different pdf files without having to do the same step multiple times. 

the data in proc report. 

1 ACCEPTED SOLUTION

Accepted Solutions
Quentin
Super User

Please see the answer to this question: https://communities.sas.com/t5/ODS-and-Base-Reporting/Producing-PDFs-per-by-Group/m-p/322352.

 

If that doesn't address your question, please expand your question with sample data, more information on what you are trying to do, and the code you have tried.

The Boston Area SAS Users Group is hosting free webinars!
Next webinar will be in January 2025. Until then, check out our archives: https://www.basug.org/videos. And be sure to subscribe to our our email list.

View solution in original post

2 REPLIES 2
Quentin
Super User

Please see the answer to this question: https://communities.sas.com/t5/ODS-and-Base-Reporting/Producing-PDFs-per-by-Group/m-p/322352.

 

If that doesn't address your question, please expand your question with sample data, more information on what you are trying to do, and the code you have tried.

The Boston Area SAS Users Group is hosting free webinars!
Next webinar will be in January 2025. Until then, check out our archives: https://www.basug.org/videos. And be sure to subscribe to our our email list.
Cynthia_sas
SAS Super FREQ

Hi:

  One suggestion that's been posted is to use BY group processing and the NEWFILE= option. Without more context for your question, it is hard to guess what you mean by different data to different PDF files without doing the same step multiple times. Does that mean something like you want some output to go to 2 PDF files, but other output to only go to one of the 2 PDF files?? It doesn't matter whether you are using PROC REPORT, PROC PRINT, PROC MEANS or PROC REG. Your ODS destination statements go above and below all the procedure code (I call it the "ODS Sandwich").

  When a procedure creates output, it writes to ALL the open ODS destinations. Typically, you have only 1 destination open at a time. Sometimes, you have different destinations, like HTML, RTF and PDF all open at the same time. However, if you need to have multiple instances of the SAME destination open to receive output, then one thing you can do is to use the ID= suboption in order to control opening and closing the open destinations. Here's an example using ODS PDF. Notice that I can use either ID= with an identifier or I can just use the identifier:

Cynthia_sas_0-1664891642564.png

Here's the output (I used STARTPAGE=NO just so all the output would fit on one page for posting):

FIRST.PDF

Cynthia_sas_1-1664891729100.png

 

SECOND.PDF

Cynthia_sas_2-1664891786889.png

 

THIRD.PDF

Cynthia_sas_3-1664891866198.png

  Another way to control what gets written to multiple ODS destinations or the same destination is to use a SAS Macro program to control the output being written. A third way is to write all the output to an ODS DOCUMENT store and then replay selected output objects to the desired destinations. But again, without more context or concrete examples, it is hard to guess.

 

Cynthia

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 2 replies
  • 617 views
  • 4 likes
  • 3 in conversation