I have read SAS threads on exporting multiple graphs which use the same predictor and response variables, but I need to export multiple graphs into a single JPG file (or EPS or TIF) when a different predictor variable is used each time. In addition, there is a group variable for some but not all graphs.
Here is the code to output to a Word file (not allowed by journal to which I am submitting):
Sorry, I was referring to this blog post: https://blogs.sas.com/content/graphicallyspeaking/2022/09/10/complex-layouts-using-the-sg-procedures...
Instead of using PNG, you should be able to use JPEG for your output. Try changing the PRINTER from PNG300 to JPEG (and change the extension on the output file). Let me know if that works for you.
Hello @dig8d0 ,
does this help?
multiple graph in a single output - SAS University Edition
Posted 07-10-2019 03:14 PM
https://communities.sas.com/t5/New-SAS-User/multiple-graph-in-a-single-output-SAS-University-Edition...
Maybe @PaulV can help you out?
Koen
Hi Koen,
I think this could be helpful although if I'm not mistaken, PROC SGPANEL does not have many formatting options, which was why I was hoping to use SGPLOT. Would I need to use a template for formatting? I have not tried using templates before so any relevant guidance would be appreciated.
Thanks!
Daria
Thanks, Paige!
This looks promising although would this approach allow for outputting the figure panels as one png, tif, or eps file? An issue I'm having is that I can't submit figures in PDF or Word format.
Thanks!
Daria
The technique in the blog post should work for jpeg as well.
In the post (Solved: ODS LAYOUT ABSOLUTE with a BY statement in PROC SGPLOT - SAS Support Communities), it looks like the solution relies on outputting to PDF using ODS PDF. I don't think such an option exists to output to JPG. Is there another way to output as JPG using the PROC DOCUMENT solution?
Thanks!
Daria
Sorry, I was referring to this blog post: https://blogs.sas.com/content/graphicallyspeaking/2022/09/10/complex-layouts-using-the-sg-procedures...
Instead of using PNG, you should be able to use JPEG for your output. Try changing the PRINTER from PNG300 to JPEG (and change the extension on the output file). Let me know if that works for you.
I am getting the following error in the log:
ods printer printer=jpeg file="C:\Figures and Supplemental\Figure1.jpeg" style=normalprinter;
ERROR: Unable to set printer path per request. This is usually because the requested printer (JPEG) is unknown.
Any workarounds? I tried setting as jpg instead and get the same error.
Thanks!
Daria
Update:
This solution worked when changing file extension to .tiff! I just had to increase the paper size to fit all 3 panels (and specified rows=2).
Thanks so much!
Daria
I'm glad you got what you needed 😀. I am curious why JPEG did not work. I looked in the device catalog, and there is both a JPEG and JPEG300 device. Just for grins, could you try JPEG300 and see if it works for you?
I get the same type of error when setting printer to JPEG300:
ods printer printer=JPEG300 file="C:\Users\Figures and Supplemental\Figure2.jpeg" style=normalprinter;
ERROR: Unable to set printer path per request. This is usually because the requested printer (JPEG300) is unknown.
My SAS license is due for an update; I doubt that would have anything to do with it. Happy to try other solutions if it helps!
Daria
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.