As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.


Here are some tips for How to share your SAS knowledge with your professional network.


High Resolution PDF Graphics via the PAPERSIZE Option

From sasCommunity
Jump to: navigation, search

Mike Zdeb

One feature of PDF graphics output from SAS procedures is that no matter the degree to which you zoom into an area of the output, the graphics still maintain their integrity. This is different behavior from bitmapped graphics output such as GIF or PNG where features such as text and lines are made up of pixels and look more and more jagged as zooming continues.

However, even though PDF graphics are vector-based and maintain their integrity upon zooming, the default line width can cause a problem with creating maps that have a lot of detail. For example, block group maps of an entire county will have a lot of detail in areas where cities are located (there tend to be lots of block groups). It is possible that the standard line thickness could obscure any fill patterns used in a thematic map.

Standard PDF graphics output from SAS procedures is produced with a paper size of 8.5in by 11in. You can change the size using system option PAPERSIZE and the change can have a dramatic effect on PDF graphics output. For example, the following code ...

options orientation=landscape;
goptions reset=all rotate=landscape;
 
pattern v=me;
 
ods results off;
ods listing close;
ods pdf file='z:\albany_normal.pdf' notoc;
 
title;
proc gmap data=z.albany (obs=1) map=z.albany all;
id block;
choro block / discrete nolegend coutline=green;
run;
quit;
 
ods pdf close;
ods results on;
ods listing;
 
options orientation=portrait;

will produce a PDF file that you can view at NORMAL MAP. If you view that map (block groups in Albany county, NY) and zoom in on the dense area on the right (the city of Albany), you can see lines that look fine 'unzoomed' but look very thick 'zoomed'.

If you modify the SAS code with an OPTIONS PAPERSIZE statement ...

options orientation=landscape;
options papersize=(50in 38.6in);
 
goptions reset=all rotate=landscape;
 
pattern v=me;
 
ods results off;
ods listing close;
ods pdf file='z:\albany_large.pdf' notoc;
 
title;
proc gmap data=z.albany (obs=1) map=z.albany all;
id block;
choro block / discrete nolegend coutline=green;
run;
quit;
 
ods pdf close;
ods results on;
ods listing;
 
options orientation=portrait;
options papersize=(11in 8.5in);

you will produce a PDF file that looks the same as the previous file when 'unzoomed' but looks much better when 'zoomed' since the line thickness is significantly thinner. The paper dimensions 50in x 38.6in gives approximately the same aspect ration as 11in x 8.5in. You can view the results of adding the PAPERSIZE option at LARGE MAP. Note, if a user of the map wants to print the PDF file, a standard printing option is 'shrink to fit', enabling a user to print the large file on standard size paper.

If you would like to try the above examples on your own, you can download the ALBANY data set used in PROC GMAP GET ALBANY.ZIP.

If you have any questions about this posting, you are welcome to send me a note by clicking here ... email Mike. To see my other SAS Community postings click here.