The SAS Output Delivery System and reporting techniques

ODS PDF Output, ODS LAYOUT GRIDDED Advance=bygroup with PROC GMAP: Maps off the page

Reply
New Contributor
Posts: 4

ODS PDF Output, ODS LAYOUT GRIDDED Advance=bygroup with PROC GMAP: Maps off the page

I'm trying to produce a pdf with gridded maps using proc gmap with a by group.

Here is the code I have so far:

 ** I've added [hidden] in the code to protect details of the information presented, but I hope this doesn't undermine the understanding.

ods pdf file="[path hidden] Maps for &sysdate9..pdf"
 gtitle startpage=never style=sasdocprinter; 

ods layout gridded advance=bygroup y=1cm x=0cm columns=2 rows=3 column_widths=(4in 4in) row_heights=(3in 3in 3in) order_type=row_major;
ods region;
goptions hpos=2 xmax=3.75cm ymax=2cm colors=(darkgray cornsilk lightblue lightskyblue royalblue deepskyblue dodgerblue mediumblue bib black);
proc gmap data=[hidden] map=wi_map all annotate=[hidden]_annotate ;
by [hidden]_Reason;
id zip;
choro num_[hidden]/ cdefault=darkgray coutline=black levels=10;
label num_[hidden]='[hidden]';
where [hidden]_Reason in('[hidden]','[hidden]');
run;
footnote;

ods layout end;

ods pdf close;

Here is a preview of what I'm seeing:

 

 

 image.png

How do I get the maps to display correctly in the columns?

 

I've tried putting heights and widths on the ods region statement, but to no avail.

Super User
Posts: 13,942

Re: ODS PDF Output, ODS LAYOUT GRIDDED Advance=bygroup with PROC GMAP: Maps off the page

Posted in reply to Delgoffe_MCRI

This is a style comment as it shouldn't effect the code behavior. When I see someone explicitly mixing units of measure, especially on the same line, I always wonder why. CM and IN on the same line??

 

I might try setting HPOS to 0 instead of 2. That option might be trying to squeeze some output into a small area.

From the HPOS documentation:

specifies the number of columns in the graphics output area, which is equivalent to the number of hardware characters that can be displayed horizontally

Since ODS doesn't really have "hardware characters" that may not actually be used but I have found a small number of goptions setting that interact oddly with some specific ODS features.

 

Similar the YMAX=2cm is much smaller vertically than 3in row height. So there might be some distortion.

 

And last, the actual map coordinates might be off center for a display area. I am guessing that is part of your "correctly" as you do not state exactly what "display correctly" would actually mean and since your document image has been cutoff we can't even see an entire "column" of the document.

 

New Contributor
Posts: 4

Re: ODS PDF Output, ODS LAYOUT GRIDDED Advance=bygroup with PROC GMAP: Maps off the page

Hello ballardw,

Thank you for your comments! The mix in units was an oversight that I hadn’t caught. I’ve fixed that to show inches only and also changed the hpos= to 0. Unfortunately the output has not changed. The titles display correctly in the gridded layout (appropriate size, centered on column, appearing in center of page without being cut off), but the graphs do not.

 

The bottom of the page has been cut off in the picture because the output correctly appears in the first row of my gridded layout and nothing comes below it. Here is the full page after changes:

image.png

 

The problem is that the first map seems to be centered on the page instead of the first column, and the second map is cut off by the page ending and is therefore only half showing.

 

I'm using long and lat coordinates in my mapping file so I'm not sure how to change the shape files to display differently if that's what's needed.

 

Ideally I would like each map to appear in its respective column, centered on the column and column heading. If there is a better way to code this while still using the by statement, I would be open to that as well.

 

Thanks again!

Super User
Posts: 13,942

Re: ODS PDF Output, ODS LAYOUT GRIDDED Advance=bygroup with PROC GMAP: Maps off the page

Posted in reply to Delgoffe_MCRI

A suggestion using non-proprietary data.

Use one of the SAS supplied map data sets and dummy such as this to create some maps

data work.displaydata;
   input state value;
datalines;
1  23
5  18
18 26
21 134
27 44
33 9
;
run;

proc gmap map=maps.us
          data= work.displaydata all
;
by state;
id state;
choro value;
run;
quit;

inside your layout code.

 

See if that works as expected. If not then you can share an entire document.

I also suggest using goptions reset=all; as some goptions seem to persist from session to session.

 

I ran your layout code with the above map and get a warning from the log:

WARNING: COLUMN_GUTTER causes WIDTH to exceed available space for PDF destination. Setting
         COLUMN_GUTTER=0 to avoid paneling.

and only the middle row of graphs actually appeared even though I have the by lines appearing for all 6 maps. My results window with the html output does show all 6 maps in 3 side-by-side pairs though.

 

I don't work with PDF's much so I'm not sure what other options may be needed. I do note that the layout apparently

Ask a Question
Discussion stats
  • 3 replies
  • 108 views
  • 0 likes
  • 2 in conversation