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.
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;
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.
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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.