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,

I am trying to create a higlow graph. I want to color the bars with different colors based on the treatment subject received.  For some reason this is not working as desired. I first created this dataset

data barcol ;

length id value fillcolor $50 ;

retain linecolor "black" ;

id = "coh"; value = "a" ; fillcolor = "red" ; output;

id = "coh"; value = "b" ; fillcolor = "green" ; output;

id = "coh"; value = "c" ; fillcolor = "orange" ; output;

run;

 

then I used this in proc sgplot statement

 

proc sgplot data=final  noautolegend nocycleattrs dattrmap=barcol;

styleattrs wallcolor = lightyellow ;

highlow y=subj low=start high=end1 / highcap=acap group=coht type=bar nooutline nomissinggroup transparency=0.1 name = 'proj' attrid = coh ;

 

Any suggestions ?

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

What are the formatted values of the variable Coht?

If you have a default format for the variable that displays text other than 'a' 'b' 'c' then the values don't match.

Or if the actual values and no custom format is assigned then 'A' is not the same as the 'a' in the dattrmap data set.

View solution in original post

2 REPLIES 2
ballardw
Super User

What are the formatted values of the variable Coht?

If you have a default format for the variable that displays text other than 'a' 'b' 'c' then the values don't match.

Or if the actual values and no custom format is assigned then 'A' is not the same as the 'a' in the dattrmap data set.

Leo9
Quartz | Level 8

Thanks for your response. I realize the mistake I made. It seems that same variable has to be used in group and attrid (atleast with same value). 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1302 views
  • 0 likes
  • 2 in conversation