First of all, I must confess to a disdain of "beautiful" or "publication quality" figures (I just need the information, not the aesthetics ), then I must lament that the need for them is inescapable. I guess gone are the days in which SAS was not good a producing a graph but excelled at produce 1,000 of them.
Aabout a year ago, I had my introduction to fonts. I admit that it was thoroughly interesting (<----NERD), and not just because I love the printing press or, more precisely, the books it produced. It was practical: how many columns can we fit with a given font and font size. I learned what a serif was and why, being mathematically inclined, why I favor non-proportional font.
Now I am facing dimensions of plots and resolutions: Width, height, and DPI/PPI. I tried to create a 9.5 X 7.0 in graph using two approaches:
1) The DESIGNWIDTH= and DESIGNHEIGHT= options to the BEGINGRAPH statement
2) The WIDTH= and HEIGHT= options to the ODS graphic statement
It may be that other options are overriding these. I am working with macros and the most verbotic logs that I have ever seen. Yet, using CNTL-D in the PDF produced with either of these approaches shows the dimensions to be 4.75 X 3.50 in.
If I change the DPI in the ODS LISTING statement to 400, then the size increases to 12.67 X 9.33 in.
Can anyone suggest a reference or issue to investigate? It is perplexing that the size is not what I attempt to specifiy.
You might investigate ODS graphics / width= height= ; to explicitly set size of graphics area availble for Proc Sgrender/Sgplot/Sgpanel etc.
You can specify the dimensions with a unit appropriate to the ods output destination such as cm in mm or more printer oriented em ex or pt.
I did both of the following, separately:
/ designwidth = 9.5 in
designheight = 7.0 in
ods graphics on
/ width = 9.5 in
height = 7.0 in
In the resuting PDF, Cntl-D reported that the dimensions were 4.75 X 3.50 in.
Only DPI = 400 increased these dimensions:
ODS Listing style = styles.__custom DPI = 400 ;
Unless I am missing a default setting, then this is perplexing. I would expect the dimensions to reflect these settings, even if the DPI (PPI?) is set (default value).
I can't see your code for your PDF output, but my guess is that you have COLUMNS=2 set or you are using ODS LAYOUT. For PDF output, the WIDTH and HEIGHT of the graph can be overriden by the PDF document due to things like like COLUMNS option, ODS LAYOUT, page size, page margins, etc. The default page size is LETTER (8.5in X 11in). Using the size you gave, that guarantees that the graph will shrink at least an inch in both directions (the proportion of the graph is maintained automatically). Then, there are default margins that will cause it to shrink more. The COLUMN option will divide the remaining page space evenly, so the graph output will be constrained to one column size.
For LISTING, there are no container restrictions, WIDTH/HEIGHT (and DPI) will make the physical size of the graph to grow, but the internals of the graph are sized differently in the two cases. Typically, you should use WIDTH and HEIGHT to make the graph bigger. DPI should be used to improve image resolution.
Hopefully, I can clarify some of the confusion for you. First, let's talk about the interaction between DESIGNWIDTH/DESIGNHEIGHT and the WIDTH/HEIGHT options.
Specifying DESIGN* in your template does two things:
1) Establishes the default size of the graph if WIDTH and HEIGHT are not specified (the default is 640px by 480px).
2) Establishes the "baseline" size of the graph (more on that in a minute).
When you specify WIDTH and HEIGHT, the final output size is generated using that size. However, the DESIGN* (whether specified or the default) can have an effect on the graph primitives. By default, things like fonts and scatter markers are scaled based a ratio between the DESIGNHEIGHT size and the HEIGHT size. This behavior can be disabled by using the SCALE option on the ODS GRAPHICS statement. So, if your HEIGHT is less than DESIGNHEIGHT, then fonts and markers will shrink slightly, which generally produces a better looking graph.
Now, to address your DPI question. The default image DPI for the LISTING is 96dpi. If you specify a higher DPI, the graph is rendered into a bigger "box" equivalent to the ratio between 96dpi and the new DPI. For example, if you specified 200dpi, the image is roughly 4 times bigger than a 96dpi image (2w X 2h). The idea is that you can take that image, put it into an area equivalent to the WIDTH and HEIGHT you requested, and get the "96dpi" image at a higher resolution. For other desitnations like PDF, RTF, and HTML, this happens for you automatically due to the nature of the output type. So, if you are creating LISTING images to put in a report, import the image into the document, set the width and height you wanted, and you should get the correct graph.
Hope this helps!
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.