The SAS Output Delivery System and reporting techniques

ODS DOCUMENT and graphics

Accepted Solution Solved
Reply
Contributor
Posts: 41
Accepted Solution

ODS DOCUMENT and graphics

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.


Accepted Solutions
Solution
‎01-21-2013 01:51 AM
Contributor
Posts: 41

Re: ODS DOCUMENT and graphics

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


All Replies
SAS Super FREQ
Posts: 8,743

Re: ODS DOCUMENT and graphics


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

Solution
‎01-21-2013 01:51 AM
Contributor
Posts: 41

Re: ODS DOCUMENT and graphics

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.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 304 views
  • 0 likes
  • 2 in conversation