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;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: