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

 

 

I want my gannt chart lines to have a color corresponding to the amount variable, akin to microsoft excel's conditional formatting. I want higher values to be red, average to be yellow and low values to be green, preferrably with gradings in between. Is there a way to colorize each line automatically based on the amount value? My real data contains hundreds of cases, so I dont want a hardcoded sollution.   

gannt.PNG

Here is my code:

 

DATA have;
 INPUT id $ amount start_dt end_dt ;
CARDS;
1 5000 21000 21030
2 30000 20870 20999
3 200 20951 21000
4 10000 20942 20987
5 500 20820 20900
;

RUN; 

data have ;
set have ;
format start_dt end_dt date9.;
run;

ods graphics on ;

proc sgplot data=have noautolegend;
highlow y=id low=start_dt high=end_dt/
         lineattrs=(thickness=6pt);
yaxis grid reverse ; 
run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

Something like this?

 

proc sgplot data=have noautolegend;
    highlow y=id low=start_dt high=end_dt/
        lineattrs=(thickness=6pt) colorresponse=Amount colormodel=(green gold red);
    gradlegend / position=right;
    yaxis grid reverse; 
run;

Result:

 

 

Udklip.PNG

View solution in original post

1 REPLY 1
PeterClemmensen
Tourmaline | Level 20

Something like this?

 

proc sgplot data=have noautolegend;
    highlow y=id low=start_dt high=end_dt/
        lineattrs=(thickness=6pt) colorresponse=Amount colormodel=(green gold red);
    gradlegend / position=right;
    yaxis grid reverse; 
run;

Result:

 

 

Udklip.PNG

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
  • 1 reply
  • 685 views
  • 0 likes
  • 2 in conversation