BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jacksonan123
Lapis Lazuli | Level 10

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;  
1 ACCEPTED SOLUTION
5 REPLIES 5
DanH_sas
SAS Super FREQ

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;
 

 

jacksonan123
Lapis Lazuli | Level 10
This option also works well.
Reeza
Super User

FILLPATTERN is an option on the Histogram statement if you want manual control of the patterns.

 

http://documentation.sas.com/?docsetId=grstatproc&docsetTarget=n17xrpcduau1f8n1c1nhe477pv18.htm&docs...

jacksonan123
Lapis Lazuli | Level 10
This is also an approach that works.

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
  • 5 replies
  • 1097 views
  • 0 likes
  • 4 in conversation