BookmarkSubscribeRSS Feed
Jeff293
Calcite | Level 5
Hello. I’m trying to expand a small map (region17) to occupy more of the gray square, so far with no success. The map appears on the gray square but not scaled-up. As intended, the map with square displays outside the borders of the big map (state2). I’m not sure if my formula for scaling up is adequate, something is happening once proc gmap is executed, or ? The coordinates are in radians with the x values negative. Previously, I was overlaying the region, not scaled up, within the borders of the state without problem but moving it outside the borders with scaling-up has been a problem. I’m using SAS 9.2. Code is below. Suggestions? thanks. Jeff

data state0;
set SASDATA1.state;
rename x=long y=lat;
run;

data state1;
length region $3.;
set state0;
region='0';
x=atan(1)/45*long;
y=atan(1)/45*lat;
run;

proc gremove data=state1 out=state2;
by region;
id stfid;
run;

data tues0;
set sasdata2.house_trial_unprj;
rename x=long y=lat;
run;

data tues17;
length region $3.;
set tues0;
region=substr(district,1,3);
if region='017';
x=atan(1)/45*long;
y=atan(1)/45*lat;
run;

data region17;
set tues17;
x=x+.063705; * moves region to center of box, not expanded;
y=y+.041363; * moves region to center of box, not expanded;
xmean=-1.33087; * xmean=-1.33087 ymean=.69232;
if x-xmean<0 then do; x=x-((abs(x-xmean))*1.05); end; *for scale-up;
if x-xmean=>0 then do; x=x+((x-xmean)*1.05); end; *for scale-up;
y=y+((y-.69232)*1.05); * for scale-up;
run;


data work.boxannotate;
length function color $ 8;
xsys='2'; ysys='2'; hsys='2';
style='msolid';
function='poly';
when='b';
color='gray88';
x=-1.343; y=.681; output;
function='polycont';
x=x+.023; y=y+0; output;
x=x+0; y=y+.023; output;
x=x-.023; y=y+0; output;
x=x+0; y=y-.023; output;
run;

goptions reset=all device=TIFFP300 gsfname=grafout gsfmode=replace rotate=portrait
hsize=4in vsize=6.5in;

pattern1 value=solid c=white;
pattern2 v=solid c=red;

filename grafout "c:\metafilesfromsas\testApril2011\test1.tif";

data combined;
set state2 region17;
run;

proc gmap
map= combined
data= combined annotate=work.boxannotate;
id region;
choro region / woutline=3 nolegend;
run;
quit;
run;
filename grafout clear;
3 REPLIES 3
Darrell_sas
SAS Employee
Without your data, it is hard to understand what you are trying to do.
Can you clarify and explain what you are trying to accomplish by "scaling up"?
Jeff293
Calcite | Level 5
By scale-up, I want to make the "region" map appear larger on the gray square. Currently, the map occupies maybe 20 percent of the gray square. I'd like to see it larger maybe occupying 75-80 percent of the square. I am using 1.3 to scale-up in my code. thanks. Jeff
GraphGuy
Meteorite | Level 14
As Darrell said, it's difficult to debug the problem, without the data to run the code & try out a few things.

Here are 2 working examples that might help:

This first example sounds like basically what you're doing ... applying an offset and re-scaling 1 map area:

http://robslink.com/SAS/democd1/explod.htm
http://robslink.com/SAS/democd1/explod_info.htm

This second one uses a different technique ... using 'proc greplay' to draw the map in the inset area:

http://robslink.com/SAS/democd41/peru_desert.htm
http://robslink.com/SAS/democd41/peru_desert_info.htm Message was edited by: Robert Allison @ SAS

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 3 replies
  • 874 views
  • 0 likes
  • 3 in conversation