03-05-2016 04:15 AM
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.
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;
03-05-2016 10:44 AM
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:
I don't know if the DPI affects the graph. I suspect not.
03-05-2016 02:23 PM - edited 03-05-2016 02:25 PM
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.
03-06-2016 05:28 AM
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.
03-07-2016 12:32 PM
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.