Data visualization with SAS programming

Trying to draw multiple gmaps on one pdf

Reply
Frequent Contributor
Posts: 110

Trying to draw multiple gmaps on one pdf

Hi guys,

Am trying to draw multiple graphs on one pdf using ODS.. I have 5 gmaps and am trying to draw all of them into one pdf

In all the 5 maps I have annotate dataset, when am using ods concept am unable to display one of the variable from annotate data set for one gmap rest of them all are fine. And I want a Blank coverpage only with 2 titles one below other.  Please help.

 

below is my code...

 

ods escapechar="^";
title;
footnote;
data test;
text="new1";

text="my acount information for the year 2016"
run;
ods pdf text="^S={font=('Arial',13pt,bold) just=center}new1";
ods pdf text="^S={font=('Arial',13pt,bold) just=center}my acount information for the year 2016";

ods pdf file="C:\users\abc\desktop\f_maps.pdf" notoc startpage=no;


proc report data=test nowd noheader style(report)={rules=none frame=void}
style(column)={font_weight=bold font_size=20pt just=c};
run;


ods pdf startpage=now;
/* Insert a logo and blank lines (used to move the title text to the center of page) */
/*ods proclabel "five graphs on one page" ;*/


goptions border hsize=3.99 in vsize=4.2 in;

title1 height= 2 'abc1 ';
title2 height= 1 'abc2';

proc gmap data=mapfips map=maps.us;
goptions horigin=0 in vorigin=4 in;
id STATECODE;
choro stcnt / annotate=stlabel coutline=grayaa;
run;
quit;
title1;
title2;


title1 height= 2 'abc3 ';
title2 height= 1 'abc4';

proc gmap data=mapfips_CDA map=mapsgfk.CANADA;
goptions horigin=4.25;
id ID1;
choro cda_cnt/annotate=stlabel1 coutline=grayaa;;
run;
quit;

/*ods pdf close;*/
/*title1;*/
/*title2;*/
/**/
/**/

 

goptions border hsize=3.99 in vsize=4.2 in;
title1 height= 2 'abc5 ';
title2 height= 1 'abc6';

proc gmap data=mapfips_latin map=mapsgfk.world;
goptions horigin=0 in vorigin=4 in;
id idname;
choro country_cnt/annotate=stlabel_lat coutline=grayaa;
run;
quit;

title1;
title2;


title1 height= 2 'abc7 ';
title2 height= 1 'abc8';


proc gmap data=map_eu map=mapsgfk.world;
goptions horigin=4.25;
id idname;
choro country_cnt/annotate=stlabel_eu coutline=grayaa;
run;
quit;

title1;
title2;


title1 height= 2 'abc9 ';
title2 height= 1'abc10';

proc gmap data=mapfips_asia map=mapsgfk.world;
goptions horigin=0 in vorigin=4 in;
id idname;
choro country_cnt/annotate=stlabel1 coutline=grayaa;;
run;
quit;
title1;
title2;

ods pdf close;

Grand Advisor
Posts: 10,236

Re: Trying to draw multiple gmaps on one pdf

You don't mention which map fails. I'm going to guess that it may be the CANADA map.

Since it appears that you are using the exact same annotate set it may be that the coordinates are not appropriate for the map that fails.

Does the Log show any warning message about values out of range?

SAS Employee
Posts: 170

Re: Trying to draw multiple gmaps on one pdf

I agree with "ballardw".  The problem seems to be with CANADA.  For one thing, the data set is not sorted to use ID1 and you are using that for "ID".  Did you try to run the GMAP that uses CANADA without PDF?   Does GMAP produce a map?  Are you getting any errors? 

 

BTW, there is an SGF Paper that talks about how to use MAPSGFK maps.  And there are examples that go further than the paper too.  I think this will fix at least one of your problems.

The paper is at:  http://support.sas.com/resources/papers/proceedings16/.

Look for a paper title: The New SAS Map Data Sets

Under that title are links to the Paper and the Examples.

This particular problem is described in the paper.  The following code will fix CANADA.

/* Sort the map data by ID1 */

proc SORT data=mapsgfk.canada

     out=smymap; by id1 id; run;

 

/* remove the lowest level of the map data set */

proc GREMOVE data=smymap

     out=mymap; by id1; id id; run;

 

/* rename ID1 to ID */

data mymap (drop=id1); set mymap;

     id=id1; run;

 

proc GMAP data=mymap map=mymap;

     id id;

     choro id / nolegend; 

run;

 

Frequent Contributor
Posts: 110

Re: Trying to draw multiple gmaps on one pdf

Hi ,

 

when i tried to run these individual gmap procedures I did't get any errors.

Yes the issue is with Canada and Asia map

 

SAS Employee
Posts: 170

Re: Trying to draw multiple gmaps on one pdf

I made up some 'data' and 'annotate' data and it worked fine.  There were 5 maps.

There were several corrections I made to your program: 

You were missing a semicolon here:  text="my acount information for the year 2016"

The following lines were missing 'inch':  goptions horigin=4.25;  (But that shouldn't matter)

 

Did you create your annotate data correctly?  For MAPS.US, the data is already projected radians so you cannot project your Annotate data.  

 

Possibly the problem is with your data which you don't provide.  I think you need to contact Tech Support and let them help you.

Ask a Question
Discussion stats
  • 4 replies
  • 189 views
  • 0 likes
  • 3 in conversation