BookmarkSubscribeRSS Feed
Manj
Fluorite | Level 6

Hi

I have created the below graph

Manj_0-1603303536255.png

My code below:


proc template;
define statgraph bar100;
begingraph / datacolors=(white lightgrey darkgrey grey black) datacontrastcolors= (black black black black black);

layout datalattice columnvar=trt01p /
columns=2 rows=1 columndatarange=union headerlabeldisplay=none /*columnheaders=BOTTOM headerlabeldisplay=value headerlabellocation=inside*/

rowaxisopts=(display=all label='Percentage of Patients' linearopts=(viewmin=0 viewmax=100 tickvaluesequence=(start=0 end=100 increment=10) viewmin=0 viewmax=100 tickvalueformat =pct.))
columnaxisopts=(display=(tickvalues) );

layout prototype / cycleattrs=true;
BARCHARTPARM X = avisit y=percent / group=avalc name="lgnd1" ;

innermargin / align=bottom opaque=true separator=True;
axistable x=avisit value=count/ display=(label) classdisplay=stack class=avalc classorder=descending labelposition=max position=1 pad=1 ;
endinnermargin;

endlayout;

sidebar / align=bottom;
entry halign=center "&trt1 | &trt2 " /opaque=true border=true borderattrs=(color=black) backgroundcolor=lightgrey textattrs=(COLOR=black size=8 ) ;
endsidebar;

sidebar / align=bottom;
discretelegend "lgnd1" /valign=bottom location=outside down=1 sortorder=ASCENDINGFORMATTED title='PGI-S response categories:' ;
endsidebar;

endlayout;

endgraph;
end;
run;


proc sgrender data=g100 template=bar100 ;
run;

 

At present both left panel and the right panel has the colours on grey scale. How do I Keep the left panel colors as it is and the right panel colors on stack varies from white to red?

 

Thanks

 

1 REPLY 1
Jay54
Meteorite | Level 14

Since you want different group colors in the right cell, then the group values for those segments have to be different.  Else, any legend will be wrong.  So, assign the groups in the right cell different values from the left cell (so now you have 10 group levels), and assign the different colors for them in the DATACOLORS option.

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
  • 1 reply
  • 540 views
  • 1 like
  • 2 in conversation