BookmarkSubscribeRSS Feed
Steffenhaldrup
Fluorite | Level 6

For some reason, the exact same code written in SAS Base 9.4 and Enterprise Guide 7.1 produce different pdf outputs in terms of quality. While both of them appears perfect inside the program (result window), only Base outputs a similar pdf results. The EG version is about the double size but very blurry.

 

The different outputs can be seen here.

 

Do you have any ideas? I find it very weird.

 

data normal (keep=x);
call streaminit(4321);
do i=1 to 2000;
	x=rand("normal")*100;
	output;
end;
output;
run;

title 'Distribution of Blood Pressure';

ods graphics on / border=off;
ods pdf file="C:\Users\stan\Dropbox\Documents\base.pdf" notoc dpi=300;
proc sgplot data=normal;
   histogram x / fillattrs=graphdata3 transparency=0.7 binstart=40 binwidth=10;
   density x / lineattrs=graphdata4;
   density x / type=kernel lineattrs=graphdata5;
   keylegend / location=inside position=topright noborder across=2;
   yaxis grid;
run;
ods pdf close;
8 REPLIES 8
Reeza
Super User

Maybe it's the viewer in each? They look identical to me...

 

Steffenhaldrup
Fluorite | Level 6

It could be the viewer. However, a 400 pct. crop tells the difference I think.


comp.png
Reeza
Super User

1. Confirm that both are accessing the same version of SAS. 

2. Try setting explicit options in ODS graphics statement so the size and antialias options are listed. It's possible that they are set differently in each application. 

 

ODS Graphics options:

https://support.sas.com/rnd/app/ODSGraphics/TipSheet_ODSGraphics.pdf

 

I don't know if the DPI affects the graph. I suspect not. 

Jay54
Meteorite | Level 14

Based on your 400% scaled image, my guess is the EG output PDF file contains an image.  This can happen based on your SAS version and content in the graph.  Even though you are asking for PDF, the file may contain an embedded image if the graph contents are not supported in vector graphics at the SAS release you (or EG) are using.  

 

For example, at SAS 9.2, all graphs in pdf files were images regardless because we did not have the feature necessary to embed scalable vector graphs.  With SAS 9.3, scalable vector graphs were added for PDF and RTF output.  However, in some cases where graph uses transparency or gradient colors, the graph is still an image.

 

With increasing release levels (including maintenance releases), more and more cases can support scalable vector output to PDF.  I believe SAS 9.40M3 has a very high level of support for scalable graphics, and only very few cases get flipped to image.  You will always see a note in the log when this happens.

Steffenhaldrup
Fluorite | Level 6

It makes so much sense - it also explains why the pdf is twice the size. 

 

Unfortunalty, my research project do not have a license for Base, only EG, so I'm forced to use it. But what irritates me most is that the graph seems perfect in the result window - why is so complicated (say, impossible) to export it so I can use it in my Latex document. In fact, it doens't have to me scalable, only useful in my document.

 

Hmm.

Reeza
Super User
Verify your version of SAS with EG. It may just be settings...or explicitly create a SVG.
Steffenhaldrup
Fluorite | Level 6

It's 7.1. But how can my settings affect the output?

ballardw
Super User

Options such as WIDTH or HEIGHT can affect resolution when rescaling an image. If the original image is built at 640*480 pixels and you expand the image to appear in a 1900*1600 window then there may not be enough information in the smaller image to get a large image clear. Make the original image as near to the final as you can estimate to minimize rescale effects. If you play with Height and Width you may also want to watch the SCALE option as you may not want everything to resize with the image, such as Title text.

 

Also results window is likely HTML output and if you are sending the output to a different format then it is just that, different.

 

The IMAGEFMT can make a different for rescaling as well.

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
  • 8 replies
  • 2667 views
  • 4 likes
  • 4 in conversation