BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
young_spruce
Fluorite | Level 6

I'm trying to output my PROC GMAP results as a JPEG to put into a presentation. I found an earlier topic and used that code. However, that topic doesn't specify how to edit the name of the resulting JPEG file. Since I need to output a lot of maps, I would like to give each JPEG a name other than "GMAPnn", to make it easier to identify.

 

1. How do can edit the name of the JPEG file? 

 

2. How do I make that name dynamic to use in a macro? 

 

FILENAME plots "&OUTPATH";
goptions reset=all 
DEVICE=jpeg 
xpixels=1200
ypixels=1000
transparency 
GSFNAME=plots 
GSFMODE=REPLACE 
NOFILEONLY;
ods _all_ close;
ods listing;

proc gmap map=map data=data;
id ID1;
choro DATA1/
cdefault=gold
coutline=white
legend=legend1;
legend1 value=(h=1 f=arial) label=(h=1 f=arial 'DATA1');
run;
quit;
ods listing close;
1 ACCEPTED SOLUTION

Accepted Solutions
GraphGuy
Meteorite | Level 14

Generally, with Proc Gmap, you can use the name= option on the choro statement to control the name of the gseg, and then the name of the gseg is used as the name of the png (or jpeg) image file. The syntax you're using is a bit 'old' ... I would recommend this newer syntax (and I also recommend using png output, rather than jpeg). The following code saves the output as the name 'mymap.png'.

 

%let name=mymap;

filename odsout '.';

goptions device=png;

ODS LISTING CLOSE;
ODS HTML path=odsout body="&name..htm" style=htmlblue;

proc gmap map=mapsgfk.us data=mapsgfk.us;
id state;
choro segment / levels=1 nolegend name="&name";
run;

quit;
ODS HTML CLOSE;
ODS LISTING;

 

 

 

 

View solution in original post

6 REPLIES 6
young_spruce
Fluorite | Level 6

Hi Kurt,

 

Thanks for the quick reply. I'm very unfamiliar with SGMAPS and can't quite figure out how to reproduce the map I created using the GMAP procedure.

 

Could you help me translate the code below into the SGMAP procedure? I'm having trouble defining colors, using the legend and subsetting the data.  

 

 

pattern1 value=solid color='CXeff3ff'; 
pattern2 value=solid color='CXbdd7e7';
pattern3 value=solid color='CX6baed6'; 
pattern4 value=solid color='CX3182bd'; 
pattern5 value=solid color='CX08519c'; 

proc gmap map=map data=data;
id ID1;
choro DATA1/
cdefault=white
coutline=white
legend=legend1;
legend1 value=(h=1 f=arial) label=(h=1 f=arial 'DATA1');
where ID2="VALUE";
run;
quit;

 

 

DanH_sas
SAS Super FREQ

I think the NAME option on the CHORO statement will do what you need.

 

Hope this helps!

Dan

GraphGuy
Meteorite | Level 14

Generally, with Proc Gmap, you can use the name= option on the choro statement to control the name of the gseg, and then the name of the gseg is used as the name of the png (or jpeg) image file. The syntax you're using is a bit 'old' ... I would recommend this newer syntax (and I also recommend using png output, rather than jpeg). The following code saves the output as the name 'mymap.png'.

 

%let name=mymap;

filename odsout '.';

goptions device=png;

ODS LISTING CLOSE;
ODS HTML path=odsout body="&name..htm" style=htmlblue;

proc gmap map=mapsgfk.us data=mapsgfk.us;
id state;
choro segment / levels=1 nolegend name="&name";
run;

quit;
ODS HTML CLOSE;
ODS LISTING;

 

 

 

 

young_spruce
Fluorite | Level 6
Sorry for the delayed response. Using the name option solved my problem and using your code worked perfectly. Thanks a lot for the help.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 1179 views
  • 5 likes
  • 5 in conversation