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

Hello everyone,

My problem is as following.

Let's assume I need to put a picture in a document in order to replay it later to other destination (useful in EG to make a report).

I need this image to have cerain width and height, so I add options to ods graphics statement.

Here's example code:

ods graphics on

/

  width = 900px

  height = 1000px

  imagefmt=png

  imagemap=no

  imagename="S_EE_pz_t"

  noborder

  noscale

  ANTIALIASMAX=110000;

ods document  name=global_report(write);

proc sgrender ...

run;

ods document close;

ods graphics off;

The SAS result is okay, it has selected image size, but when I trying replay the picture, the result is slightly rescaled (always to 640x480).

Moreover, since it's a vector graphics, it's being rescaled like a vector, and the result is kind of messy.


Is there a way to prevent rescaling or any other way to prevent images of being distorted?

Or why the maximum size is 640x480 and is it a way to increase it?


Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
ghastly_kitten
Fluorite | Level 6

Okay, I had a fun week solving this problem.

And with help of SAS Support which asked me to send them a short test code I found out what's the problem.

Here's the example which were considered as a "proof of concept":

ods graphics on

/

  width = 900px

  height = 1000px

  imagefmt=png

  imagemap=no

  imagename="air_img"

  noborder

  noscale

  ANTIALIASMAX=110000;

ods document  name=global_report(write);

proc sgplot data=SASHELP.air;

      title "Airline travel dynamics";

      series x=date y=air;

run;

ods document close;

ods graphics off;

proc document name=global_report;

      replay;

run;

I deliberately underlined the ods graphics statement, because that was the key: when I'd wrote this example the question appeared "Why didn't I include the proc document in the ods graphics scope?".

And here we get the correct code:

ods graphics on

/

  width = 900px

  height = 1000px

  imagefmt=png

  imagemap=no

  imagename="air_img"

  noborder

  noscale

  ANTIALIASMAX=110000;

ods document  name=global_report(write);

proc sgplot data=SASHELP.air;

      title "Airline travel dynamics";

      series x=date y=air;

run;

ods document close;


proc document name=global_report;

      replay;

run;


ods graphics off;


Voila! Everything has the right size which reveals that proc document actually use current ODS Graphics settings, not the original one.

Now everything become obvious for me, but I wish SAS had placed a notice in the proc document or ods document help about this feature.



Next level question is: what if I have 20 images of different sizes, should I use 20 reports (or do manual output "by name" in proc document, which is equivalent) and 20 ods graphics statements to reproduce it?

At the moment I'm sure the answer is only - YES.

Still, any suggestions would be very appreciated.

View solution in original post

2 REPLIES 2
Cynthia_sas
SAS Super FREQ


Hi:

  Since you have ODS DOCUMENT and ODS GRAPHICS in the mix, this is probably something you would want to address with Tech Support.

  There's a link at the bottom of each page in the forum that shows the words "submit a problem report" in tiny blue letters down by the SAS logo.

cynthia

ghastly_kitten
Fluorite | Level 6

Okay, I had a fun week solving this problem.

And with help of SAS Support which asked me to send them a short test code I found out what's the problem.

Here's the example which were considered as a "proof of concept":

ods graphics on

/

  width = 900px

  height = 1000px

  imagefmt=png

  imagemap=no

  imagename="air_img"

  noborder

  noscale

  ANTIALIASMAX=110000;

ods document  name=global_report(write);

proc sgplot data=SASHELP.air;

      title "Airline travel dynamics";

      series x=date y=air;

run;

ods document close;

ods graphics off;

proc document name=global_report;

      replay;

run;

I deliberately underlined the ods graphics statement, because that was the key: when I'd wrote this example the question appeared "Why didn't I include the proc document in the ods graphics scope?".

And here we get the correct code:

ods graphics on

/

  width = 900px

  height = 1000px

  imagefmt=png

  imagemap=no

  imagename="air_img"

  noborder

  noscale

  ANTIALIASMAX=110000;

ods document  name=global_report(write);

proc sgplot data=SASHELP.air;

      title "Airline travel dynamics";

      series x=date y=air;

run;

ods document close;


proc document name=global_report;

      replay;

run;


ods graphics off;


Voila! Everything has the right size which reveals that proc document actually use current ODS Graphics settings, not the original one.

Now everything become obvious for me, but I wish SAS had placed a notice in the proc document or ods document help about this feature.



Next level question is: what if I have 20 images of different sizes, should I use 20 reports (or do manual output "by name" in proc document, which is equivalent) and 20 ods graphics statements to reproduce it?

At the moment I'm sure the answer is only - YES.

Still, any suggestions would be very appreciated.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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