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

Hi All,

 

Is there a way to change the bar color in the high-low plot without using attrid and dattrmap ? I am trying to plot high-low where their are three bars and I want to sign unique color to each bar based on treatment. Your help is appreciated.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

It is always best to supply the code that you are using so we can see the statements and options.

 

The following call to PROC SGPLOT uses the STYLEATTRS statement to assign colors for the bars. Just be aware that which color is assigned to which group depends on the order of the data, so you might need to experiment to get the colors to match the groups in your data:

proc sgplot data=sashelp.stocks(where=(Date >= '01JAN2005'd));
  styleattrs datacolors=(blue red green);
  highlow x=date high=high low=low 
    / group=Stock type=bar groupdisplay=cluster;
run;

View solution in original post

2 REPLIES 2
ballardw
Super User

If you use a GROUP= option with the name of the variable holding your "treatment" values then you will get a separate color for each value of treatment (assuming you only have 3 values).

 

You would need the Group= options for DATTRMAP to apply anyway.

Rick_SAS
SAS Super FREQ

It is always best to supply the code that you are using so we can see the statements and options.

 

The following call to PROC SGPLOT uses the STYLEATTRS statement to assign colors for the bars. Just be aware that which color is assigned to which group depends on the order of the data, so you might need to experiment to get the colors to match the groups in your data:

proc sgplot data=sashelp.stocks(where=(Date >= '01JAN2005'd));
  styleattrs datacolors=(blue red green);
  highlow x=date high=high low=low 
    / group=Stock type=bar groupdisplay=cluster;
run;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 1286 views
  • 4 likes
  • 3 in conversation