I have the following code which works. Can someone tell me how to modify the code so that the graph will have patterns instead of color?
ods pdf file='/folders/myfolders/Cmax_con/peaksdistr.pdf/';
ods graphics on /width=4 in;
title 'Cmax distribution Peak1';
proc sgplot data=peak1;
histogram y/ legendlabel='Calculated Cmax' fillattrs=(color=red) name= 's' legendlabel ='Calculated Cmax' transparency=0.5 ;
histogram dv/ legendlabel='Calculated Cmax' fillattrs=(color=green) name= 'o' legendlabel ='Observed Cmax' transparency=0.5 ;
keylegend 's' 'o' /location=inside position =topright across=1;
xaxis label='ng/ml';
run;
ods pdf close;
You might prefer one of the journal styles.
Perhaps add style=journal2 to your ODS PDF statement.
You might prefer one of the journal styles.
Perhaps add style=journal2 to your ODS PDF statement.
For v940m5, it is as simple as specifying FILLPATTERN and NOFILL on both HISTOGRAM statements. However, for prior versions, you will need to make an ODS style change to get the patterns. Something like the following:
proc template;
define style styles.mypat;
parent=styles.HTMLBlue;
style Graphhistogram from GraphComponent /
displayopts = "outline fillpattern"
;
end;
run;
ods html style=styles.mypat;
proc sgplot data=sashelp.class;
histogram weight;
histogram height;
run;
FILLPATTERN is an option on the Histogram statement if you want manual control of the patterns.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.