I have SGPLOT code working and it outputs 40+ graphs (this is dependent on the input and can change from run to run) to a pdf. I'm trying to force 2 graphs on one page as a space saver. I've tried startpage=no or startpage=never, and any of those end up reducing everything to one page and i only end up with 1 page and 1 graph instead of 40 pages and 40 graphs.
Here's my code: (EDITED to note that i do not have the abilty to post the actual code as it's on an enclave computer, with no internet access and no copy rights out of it into another machine).
Look at adjusting your PAGESIZE option for output with the OPTIONS statement and using ODS Graphics options to set the height and width of your graph output.
ODS Graphics/ height =4in width=7in;
would set the graph size to 4 by 7 inches.
If your pagesize is at least 8.5in by 8in two should fit. There will be some space between the graphs.
When you say that you have created one page with one graph where you expect more then you seem to have something else going one.
Also you show a %do loop but no %end statement so you may be having issues with your macro in general that would be very hard to diagnose without data and full code.
Sorry, there is an actual %end. I have an if/then based on something else and pulled the other one out to simplify the picture for the post. I've updated the picture.
When i do startpage=no or startpage=never, that's when it goes from 1 graph per page and 40+ pages to just 1 graph and 1 page. When remove startpage, then it goes back to normal.
I added the ods graphics height and width and it made the graphs smaller, and visually there is plenty of page left for a second graph per page, but there's still only one graph per page.
EDITED to add screenshot of graph output. As you can see, there's PLENTY of room for 2 on each page:
Please show the actual code with the ods options.
Did you have a working program without macros that would place two graphs as needed?
From online documentation for ODS PDF
STARTPAGE=NEVER | NO | NOW | YES
controls page breaks.
specifies not to insert page breaks, even before graphics procedures.
specifies that no new pages be inserted at the beginning of each procedure, or within certain procedures, even if new pages are requested by the procedure code. A new page will begin only when a page is filled or when you specify STARTPAGE=NOW.
FYI - Code as a picture and that we can't run isn't very helpful. Ideally you'd use a SASHELP dataset and we could replicate your issue. At minimum I'm not likely to type out your code to test it.
Given what you've shown, startpage should work, but I don't see that listed anywhere in the code.
Can you show the code when you have that option on? And what version of SAS are you using?
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.