Data visualization with SAS programming

function='image' GIF dimensions

Posts: 0

function='image' GIF dimensions

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;
x=0; y=0; output;
x=symget('xsize'); y=0; output;
x=symget('xsize'); y=symget('ysize'); output;
x=0; y=symget('ysize'); output;

data body_pic;
length function $ 8 style color $ 12 html $ 1000;
function='move'; x=0; y=0; output;
function='image'; x=&xsize; y=&ysize;
imgpath='C:\dummy.jpg'; style='fit'; output;

data spots;
set claim2;
length function $ 8 style color $ 12 html $ 1000;
xsys='2'; ysys='2'; hsys='3'; when='a';
SAS Employee
Posts: 980

Re: function='image' GIF dimensions

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! Smiley Happy
Posts: 0

Re: function='image' GIF dimensions

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.
SAS Employee
Posts: 980

Re: function='image' GIF dimensions

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 :-)
Ask a Question
Discussion stats
  • 3 replies
  • 2 in conversation