Data visualization with SAS programming

ods graphics imagefmt = pdf

Reply
New Contributor
Posts: 3

ods graphics imagefmt = pdf

Hi,
WIth a template, I have created a two-by-two plot, where each cell vary independently. I would like to output this as a pdf file, but I face the issue that the axes for the last plot is thicker than the rest, despite this cell is created exactly like the others. 

 

I have tried to 'fix' the line thickness through a style:

proc template;
define style MyFont;
parent = styles.listing;
style Graphaxislines / linethickness = 26px;
end;
run;

 

but as you can see in the attached this will not solve the issue.

There is no problem when I output as png or tiff.

 

Anybody who have seen this, any solution? I'm running v. 9.4

 

Thanks.

 

Regards

Jens-Kristian

Super User
Super User
Posts: 7,695

Re: ods graphics imagefmt = pdf

How are you creating the output?  Its a good idea to show the code, use the {i} above post area to post code as that retains your formatting so its easy to read.  We always tend to go with creating RTF files like this:

ods rtf file="abc.rtf";
 
proc sgplot...;
run;

ods rtf close;

And then convert to PDF from there.  Now you may be able to go straight to PDF, but I noted several oddities if you don't have the correct settings in PDF, for instance I didn't have DPI high enough when printing from Word to PDF and the axis just wasn't shown.  

Its hard to debug from what you show as it could be the PDF app or it could be your SAS code.

SAS Super FREQ
Posts: 196

Re: ods graphics imagefmt = pdf

I can't see your attachment.  Some thoughts:

Are you sure there is something wrong?  Often when looking a PDF files on line, lines will disappear or look different.  If you print or zoom they look fine.  This is the nature of the viewer not the PDF file.

 

I personally tend to use the PDF destination, FWIW.

 

Why not use a style designed for PDF?  I would not use LISTING.  PEARL is the default PDF style.  Or if you want something more like HTMLBlue (for tables), try Sapphire.  There is also the journal family of styles.

New Contributor
Posts: 3

Re: ods graphics imagefmt = pdf

Hi,

My code included below. I am not sure how my pdf settings are (standard I guess).

 

I can go with 600 dpi if I write directly to pdf. Otherwise I get this ERROR:

WARNING: A very large output size of (4000, 3000) is in effect. This could make

Java VM run out of memory and result in some Java exceptions. You should

reduce the output size or DPI settings.

ERROR: Java virtual machine exception. java.lang.OutOfMemoryError: Java heap space.

ERROR: Java virtual machine exception. java.lang.OutOfMemoryError: Java heap space.

 

If I use a smaller dpi, output to e.g. gif, png or tiff  and post-process it to a pdf, it will not be as nice as a direct pdf.

 

Regards

Jens-Kristian 

proc template;

define style MyFont;

parent = styles.listing;

style Graphaxislines / linethickness = 26px;

end;

run;

proc template;

define statgraph star;

begingraph;

entrytitle halign = left textattrs = (family = 'Helvetica' size = 9pt weight = bold) "TITLE GOES HERE";

entryfootnote halign = left textattrs=(family = 'Arial' size = 6pt) "FOOT GOES HERE";

layout lattice /

rows = 2 rowweights = (0.5 0.5) colums = 2 columnweights = (0.5 0.5) rowgutter = 0px columngutter = 0px border = false

rowdatarange = data columndatarange = data skipemptycells = true

;

cell;

cellheader;

entry halign = left "(a) VAR1" / border = false;

endcellheader;

layout overlay /

walldisplay = none

xaxisopts = (label = " " offsetmin = 0.01 offsetmax = 0.1 linearopts = (tickvaluelist = (0 3 7 21 56 84) tickvaluefitpolicy = none))

yaxisopts = (type = linear label = "VAR1")

;

seriesplot x = VISITDAY y = VAR1 / group = ARM name = 'se';

scatterplot x = VISITDAY y = VAR1 / group = ARM yerrorlower = LOWVAR1 yerrorupper = UPPVAR1 name = 'sc';

endlayout;

endcell;

cell;

cellheader;

entry halign = left "(a) VAR2" / border = false;

endcellheader;

layout overlay /

walldisplay = none

xaxisopts = (label = " " offsetmin = 0.01 offsetmax = 0.1 linearopts = (tickvaluelist = (0 3 7 21 56 84) tickvaluefitpolicy = none))

yaxisopts = (type = linear label = "VAR2")

;

seriesplot x = VISITDAY y = VAR2 / group = ARM name = 'se';

scatterplot x = VISITDAY y = VAR2 / group = ARM yerrorlower = LOWVAR2 yerrorupper = UPPVAR2 name = 'sc';

endlayout;

endcell;

cell;

cellheader;

entry halign = left "(a) VAR3" / border = false;

endcellheader;

layout overlay /

walldisplay = none

xaxisopts = (label = " " offsetmin = 0.01 offsetmax = 0.1 linearopts = (tickvaluelist = (0 3 7 21 56 84) tickvaluefitpolicy = none))

yaxisopts = (type = linear label = "VAR3")

;

seriesplot x = VISITDAY y = VAR3 / group = ARM name = 'se';

scatterplot x = VISITDAY y = VAR3 / group = ARM yerrorlower = LOWVAR3 yerrorupper = UPPVAR3 name = 'sc';

endlayout;

endcell;

cell;

cellheader;

entry halign = left "(a) VAR4" / border = false;

endcellheader;

layout overlay /

walldisplay = none

xaxisopts = (label = " " offsetmin = 0.01 offsetmax = 0.1 linearopts = (tickvaluelist = (0 3 7 21 56 84) tickvaluefitpolicy = none))

yaxisopts = (type = linear label = "VAR4")

;

seriesplot x = VISITDAY y = VAR4 / group = ARM name = 'se';

scatterplot x = VISITDAY y = VAR4 / group = ARM yerrorlower = LOWVAR4 yerrorupper = UPPVAR4 name = 'sc';

endlayout;

endcell;

 

sidebar / align=bottom;

mergedlegend 'se' 'sc' / border = false title = " " valueattrs = (family = "Arial" size = 7pt) exclude = (" ") across = 2;

endsidebar;

endlayout;

endgraph;

end;

run;

 

ods listing gpath = "M:\" image_dpi = 600 style = MyFont;

ODS graphics / reset = all imagename = "TEST" imagefmt = pdf height = 18cm width = 18cm noborder;

proc sgrender data = b template= star;

run;

 

 

Super User
Posts: 11,114

Re: ods graphics imagefmt = pdf

PX or pixels is a very unreliable size "unit". Pixel size varies between monitors and resolution settings and has no reliable conversion ot paper/document print settings. You may want to experiment with another measure such as in, cm or mm.

New Contributor
Posts: 3

Re: ods graphics imagefmt = pdf

Thanks for the tip, I will do that. But that does not change the strange thing that, when plotting directly to pdf, the axes are thicker for the last frame, and only the last.

Ask a Question
Discussion stats
  • 5 replies
  • 171 views
  • 0 likes
  • 4 in conversation