sample code continued (wouldn't fit in one post in the preview window) ....
**** GET FREQUENCY COUNTS FOR CHART AND PUT IN FREQOUT DATA SET.;
proc freq
data = pain
noprint;
by trt;
tables pain /out = freqout;
run;
**** NEED PROC TEMPLATE STEP TO CONTROL PAGE MARGINS;
PROC TEMPLATE;
DEFINE STYLE MYTHEME;
PARENT = STYLES.THEME;
REPLACE BODY FROM DOCUMENT
"UNDEF MARGINS SO WE GET THE MARGINS FROM THE PRINTER OR SYS OPTION"
/
BOTTOMMARGIN = _UNDEF_
TOPMARGIN = _UNDEF_
RIGHTMARGIN = _UNDEF_
LEFTMARGIN = _UNDEF_;
END;
RUN;
**** OPEN ODS DESTINATION, SET PAGE ORIENTATION AND MARGINS IN OPTIONS STATEMENT
**** INCLUDE THE STYLE (MYTHEME) CREATED FROM PROC TEMPLATE STEP;
OPTIONS ORIENTATION=LANDSCAPE TOPMARGIN=2.12 CM BOTTOMMARGIN=2.54 CM NODATE NONUMBER;
ODS LISTING CLOSE;
ODS NORESULTS;
ODS RTF FILE="C:\TEMP\TEST2.RTF" STYLE=MYTHEME;
**** DEFINE GRAPHICS OPTIONS: SET DEVICE DESTINATION TO MS
**** OFFICE CGM FILE, REPLACE ANY EXISTING CGM FILE, RESET ANY
**** SYMBOL DEFINITIONS, AND SET BACKGROUND TO WHITE AND OTHER **** COLORS TO BLACK.;
goptions reset = all
VSIZE = 6IN
HSIZE = 9IN
cback = white
colors = (black)
FTEXT = 'Courier New';
**** DEFINE BAR PATTERNS: WHITE = PLACEBO, GRAY = OLD DRUG,
**** BLACK = NEW DRUG.;
pattern1 value = solid color = white;
pattern2 value = solid color = gray;
pattern3 value = solid color = black ;
**** DEFINE HORIZONTAL AXIS OPTIONS.;
axis1 label = (h = 1 'Pain Score')
value = (h = 1 )
order = (0 to 4 by 1);
**** DEFINE VERTICAL AXIS OPTIONS.;
axis2 label = (h = 1.2 r = 0 a = 90 'Percentage of Patients' )
order = (0 to 50 by 10);
**** CREATE BAR CHART. PERCENTAGE OF PATIENTS IS ON THE Y AXIS,
**** PAIN SCORE BY TREATMENT IS ON THE X AXIS.;
proc gchart
data = freqout;
vbar3d pain /group = trt
sumvar = percent
maxis = axis1
raxis = axis2
midpoints = 0 1 2 3 4
cframe = white
coutline = black
outside = sum
patternid = group;
format trt trt.
pain score.
percent newpct.;
title1 j = c h = 1.5 color = black
"Figure 6.3";
title2 j = c h = 1.5 color = black
"Summary of Pain Score by Treatment";
run;
quit;
ODS RTF CLOSE;
ODS RESULTS;
ODS LISTING;