BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
fastb
Fluorite | Level 6

Hi,

I have written a macro to make a pdf with results for analytes tested in crops.  There is a one page summary for each analyte with a box and whisker plot, histogram, scatter plot, and summary statistics table.

I have the columns set to 4 inches wide, but I cannot get the graphs to utilize all available width in the columns.

How can I make the plots wider?

Code and example output attached.

Thanks!

ods _all_ close;


%MACRO SGPLOT; %DO i=1 %TO &total;
ODS NORESULTS; ODS PDF STARTPAGE=NOW NOTOC /*STYLE=ceafigstyle*/;
ODS GRAPHICS ON / ANTIALIASMAX=1400;
ODS LISTING /*STYLE=ceafigstyle*/ GPATH =
'<path inserted here>' IMAGE_DPI=600;
OPTIONS topmargin=0.1in bottommargin=0.1in leftmargin=0.1in rightmargin=0.1in NODATE NONUMBER ORIENTATION=Portrait;
ODS PDF FILE="<file inserted here>";
TITLE "&&CROP_TYPE&i& &&TISSUE_TYPE&i &&ANALYTE&i";

ods layout gridded columns = 2 rows = 1 row_heights = (3in)  column_widths = (4.00in 4.00in);
ODS REGION;
PROC SGPLOT DATA=summary_pages_box NOAUTOLEGEND NOCYCLEATTRS;
WHERE CROP_TYPE="&&CROP_TYPE&i" AND TISSUE_TYPE="&&TISSUE_TYPE&i" AND ANALYTE="&&ANALYTE&i";
TITLE "&&CROP_TYPE&i& &&TISSUE_TYPE&i &&ANALYTE&i"; HBOX VALUE; RUN;

ODS REGION;
PROC SGPLOT DATA=summary_pages_all NOAUTOLEGEND NOCYCLEATTRS;
WHERE CROP_TYPE="&&CROP_TYPE&i" AND TISSUE_TYPE="&&TISSUE_TYPE&i" AND
ANALYTE="&&ANALYTE&i";
TITLE "&&CROP_TYPE&i& &&TISSUE_TYPE&i &&ANALYTE&i";
HISTOGRAM VALUE/boundary=lower; DENSITY VALUE; RUN;

ods layout end;

ods layout gridded columns = 1 rows = 2 row_heights = (3in 3in);
ODS REGION;
PROC SGPLOT DATA=summary_scatter NOAUTOLEGEND NOCYCLEATTRS;
WHERE CROP_TYPE="&&CROP_TYPE&i" AND TISSUE_TYPE="&&TISSUE_TYPE&i" AND
ANALYTE="&&ANALYTE&i";
YAXIS label="&&UNIT_OF_MEASURE&i&" min =0 OFFSETMIN = 0.08 OFFSETMAX = 0.08;
XAXIS DISPLAY=(nolabel) OFFSETMIN=0.05 OFFSETMAX=0.05;
X2AXIS display = (nolabel noticks novalues) values=(0 to 100 by 100)
OFFSETMIN=0 OFFSETMAX=0;
TITLE "&&CROP_TYPE&i& &&TISSUE_TYPE&i &&ANALYTE&i";
SCATTER x=Pass_Fail y=VALUE / NOMISSINGGROUP MARKERATTRS=(SIZE=10px); RUN;


ODS REGION;
PROC REPORT NOWINDOWS LIST DATA=summary_stats_tables;
WHERE CROP_TYPE="&&CROP_TYPE&i" AND TISSUE_TYPE="&&TISSUE_TYPE&i" AND
ANALYTE="&&ANALYTE&i";
COLUMNS Statistic Value;
DEFINE Statistic / display format = $20. width=20 center "Statistic";
define Value / display format = best8. width = 8 center "Value"; RUN;

ods layout end;
%END; %MEND SGPLOT; %SGPLOT;
ODS PDF CLOSE;

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

The size of the graphics are determined by the ODS GRAPHICS ON statement, so use the WIDTH= and HEIGHT= options, like this:

 

ODS GRAPHICS ON / ANTIALIASMAX=1400 width=400px height=300px;

View solution in original post

1 REPLY 1
Rick_SAS
SAS Super FREQ

The size of the graphics are determined by the ODS GRAPHICS ON statement, so use the WIDTH= and HEIGHT= options, like this:

 

ODS GRAPHICS ON / ANTIALIASMAX=1400 width=400px height=300px;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1 reply
  • 497 views
  • 0 likes
  • 2 in conversation