sas - Getting vector-graphics output from PROC SGPLOT in PDF -
anyone have hints getting clean pdf output proc sgplot (and similar functions sgscatter)?
when create graph , write pdf ods, result looks fine in sas eg report window pdf output gets rasterized dpi setting of pdf if zoom pdf can make out pixelation. additionally, if don't define colors/line styles, output in pdf use different colors , styles (lines solid in sas report window become dashed in pdf).
if make same chart proc gplot, comes vectorized text , lines don't junk when zoomed/printed.
is there option need change? flag need set? i've tried things options device=svg
, doesn't seem work. setting high dpi isn't solution either.
code example (but really, happens on of sg* functions data/code):
options nonumber orientation=landscape; ods pdf file='filename.pdf' notoc; proc sgplot data=shipped; series x=date y=weighted_price / group=type; run; proc gplot data=shipped; plot weighted_price*date=type; symbol1 c=blue i=join v=none w=1 l=1; symbol2 c=red i=join v=none w=1 l=1; symbol3 c=brown i=join v=none w=1 l=1; run; ods pdf close;
these produce equivalent graphs in sas eg results window (except sgplot looks nicer) when end in pdf, sgplot rasterized image , dropped onto pdf page while gplot comes out lovely vector chart.
edit: see solutions posted below. didn't find documented, sas 9.2 did not have pdf support. there couple of workarounds ok 1-off chart, best solution upgrade sas 9.3.
here minimal example (the sgplot code comes sas docs):
ods graphics / imagefmt=pdf; ods pdf file = 'c:\temp\report.pdf'; proc sgplot data=sashelp.class; scatter x=height y=weight; ellipse x=height y=weight; run; ods pdf close;
the imagefmt=pdf
snippet tells sas create image in pdf, instead of adding rastering of png pdf report. snippet should produce file named report.pdf in c:\temp directory. image in scalable.
there more in links below.
Comments
Post a Comment