BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Is there any way to prevent the dimensions of the image BackByLoc.gif from being changed?
When I output BackByLoc.gif (which is on top of the image dummy.jpg) the dimensions are being altered from their original dimensions.

%let xsize=160;
%let ysize=320;
%let piesize=1;
data body_map;
idnum=1;
x=0; y=0; output;
x=symget('xsize'); y=0; output;
x=symget('xsize'); y=symget('ysize'); output;
x=0; y=symget('ysize'); output;
run;

data body_pic;
length function $ 8 style color $ 12 html $ 1000;
xsys='2';ysys='2';hsys='3';when='a';
function='move'; x=0; y=0; output;
function='image'; x=&xsize; y=&ysize;
imgpath='C:\dummy.jpg'; style='fit'; output;
run;

data spots;
set claim2;
length function $ 8 style color $ 12 html $ 1000;
xsys='2'; ysys='2'; hsys='3'; when='a';
function='label';
x=x;y=y;
style="'Arial/bold'";size=2.5;
color='red';
text=trim(left(description));
output;
function='image';
x=140;y=200;
imgpath='C:\BackByLoc.gif';
style='fit';
output;
run;
3 REPLIES 3
GraphGuy
Meteorite | Level 14
Sounds like you've got annotated images figured out ... to the extent of their ability 😉

To get a single copy of the image, you must specify the corners of the area, and then let the image fill the area ... and unless you just happen to get the size of the rectangle "just right" (in combination with the size/proportions of your entire page), then it's gonna stretch the graphic out of proportion. Takes a lot of trial-and-error to get things just-right ... and then after that you can't ever change the size of the page, etc.

I've had a defect/suggestion entered for quite a while, requesting the developers add a way to annotate an image which preserves the original aspect ratio (unlike style='fit') and only produces 1 copy of the image (unlike style='tile'). Customer feedback to tech support usually helps increase the likelihood that features get added, so if you could let tech support know you're interested in this, and maybe have them add a note to defect/suggestion S0134750 that you're interested, maybe that'll help this new feature request gain some momentum! 🙂
deleted_user
Not applicable
From SAS:
"I have added a note to the defect that another customer has requested this capability."

Although I know you already sent me a couple of approaches for adding images to my plots, I was wondering if you could tell me what would be the most similar approach to the code I have above?
Thank you.
GraphGuy
Meteorite | Level 14
Assuming that you're using "proc gmap" (this will only work with gmap, because gmap preserves the x/y proportions of the map area...)

---

If you know the size of the image you're annotating (ie, the number of pixels in the x direction & y direction)...

And you know the proportions of the gmap area you're annotating stuff into...

Then, you could (hypothetically) use xsys/ysys='2' to position the bottom/left corner of the image you're annotating, and then switch into xsys/ysys=1 (percent-based coordinate system) and mathematically calculate the x and y offset from that position for the top/right corner of the image (based on the proportions of the annotated image, and the proportions of the map area) to preserve the aspect ratio of the annotated image.

I've never tried this, but it seems like it should (hypothetically) be do-able 🙂

sas-innovate-2024.png

 

Secure your spot at the must-attend AI and analytics event of 2024: SAS Innovate 2024! Get ready for a jam-packed agenda featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events.

 

Register by March 1 to snag the Early Bird rate of just $695! Don't miss out on this exclusive offer. 

 

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
  • 671 views
  • 0 likes
  • 2 in conversation