<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to get split graph with labels on the bars in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/830284#M328070</link>
    <description>&lt;A href="https://blogs.sas.com/content/graphicallyspeaking/2012/07/23/butterfly-plots/" target="_blank"&gt;https://blogs.sas.com/content/graphicallyspeaking/2012/07/23/butterfly-plots/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2018/05/23/butterfly-plot.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2018/05/23/butterfly-plot.html&lt;/A&gt;</description>
    <pubDate>Thu, 25 Aug 2022 13:06:15 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2022-08-25T13:06:15Z</dc:date>
    <item>
      <title>How to get split graph with labels on the bars</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/830256#M328058</link>
      <description>&lt;P&gt;I have the below code as a reference which i am using and i am almost there in getting my final graph but missing few things can someone help me with getting the labels in between and also within the bars as well.&lt;/P&gt;
&lt;P&gt;The below is the sample code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let name=bar4;
filename odsout 'C:\Users\ravindra.babu\OneDrive - OneWorkplace\Projs';

proc format; picture posval low-high='000,009'; run;

data my_data;
input ITEM $ 1-6 left right;
format amount posval.;
illusion='Group 1'; amount=-1*left; output;
illusion='Group 2'; amount=right; output;
datalines;
ITEM A  41 58
ITEM B  53 51 
ITEM C  42 33 
ITEM D  23 28
ITEM E  12 17
ITEM F  18 13
;
run;

data my_data; set my_data;
length htmlvar $300;
htmlvar=
 'title='||quote(
  'Item: '|| trim(left(item))||'0D'x||
  'Group 1: '|| trim(left(left))||'0D'x||
  'Group 2: '|| trim(left(right))
  )||
 ' href="bar4_info.htm"';
run;


goptions device=png;
goptions noborder;
 
ODS LISTING CLOSE;
ODS HTML path=odsout body="&amp;amp;name..htm" 
 (title="GChart Paired-Bar Chart") 
 style=htmlblue;

goptions gunit=pct htitle=6 ftitle="albany amt/bold" htext=4.25 ftext="albany amt/bold";
goptions ctext=gray33;

axis1 label=none;  
axis2 label=none order=(-60 to 60 by 10) minor=none offset=(0,0) value=(h=3pct);

pattern1 v=solid color=cxbd0026;  
pattern2 v=solid color=cx43a2ca; 

legend1 label=none position=(bottom) cframe=white
 shape=bar(3,3) cborder=white across=2;

title1 ls=1.5 "Paired-Bar Chart";

proc gchart data=my_data; 
hbar item / discrete type=sum sumvar=amount nostats
 subgroup=illusion 
 maxis=axis1 raxis=axis2 
 autoref clipref cref=graycc
 legend=legend1 coutline=same
 html=htmlvar
 des="" name="&amp;amp;name";  
run;

quit;
ODS HTML CLOSE;
ODS LISTING;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The below is the final example output that i am looking for, can i get some help on this please.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Picture1.jpg" style="width: 541px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/74674i3DD5D2B7B1CBC315/image-size/large?v=v2&amp;amp;px=999" role="button" title="Picture1.jpg" alt="Picture1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2022 10:16:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/830256#M328058</guid>
      <dc:creator>Ravindra_</dc:creator>
      <dc:date>2022-08-25T10:16:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to get split graph with labels on the bars</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/830284#M328070</link>
      <description>&lt;A href="https://blogs.sas.com/content/graphicallyspeaking/2012/07/23/butterfly-plots/" target="_blank"&gt;https://blogs.sas.com/content/graphicallyspeaking/2012/07/23/butterfly-plots/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2018/05/23/butterfly-plot.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2018/05/23/butterfly-plot.html&lt;/A&gt;</description>
      <pubDate>Thu, 25 Aug 2022 13:06:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/830284#M328070</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-08-25T13:06:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to get split graph with labels on the bars</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/830330#M328086</link>
      <description>I was able to get the butterfly plot but can i know an option to differentiate those two and add visit information that represent both left and right side.</description>
      <pubDate>Thu, 25 Aug 2022 14:30:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/830330#M328086</guid>
      <dc:creator>Ravindra_</dc:creator>
      <dc:date>2022-08-25T14:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to get split graph with labels on the bars</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/830336#M328089</link>
      <description>&lt;P&gt;Have a look at the following examples:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://robslink.com/SAS/democd63/lithuania_demographics_info.htm" target="_blank" rel="noopener"&gt;http://robslink.com/SAS/democd63/lithuania_demographics_info.htm&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;&lt;A title="Population by Age and Sex for Hawaii County, Hawaii" href="http://robslink.com/SAS/democd37/hawaii_info.htm" target="_blank" rel="noopener"&gt;http://robslink.com/SAS/democd37/hawaii_info.htm&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;For both of these links,&amp;nbsp;check the example link to see the output, and the sas code link to see the SAS code generating the output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2022 14:43:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/830336#M328089</guid>
      <dc:creator>AhmedAl_Attar</dc:creator>
      <dc:date>2022-08-25T14:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to get split graph with labels on the bars</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/830369#M328098</link>
      <description>thank you, i will try this one</description>
      <pubDate>Thu, 25 Aug 2022 15:49:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/830369#M328098</guid>
      <dc:creator>Ravindra_</dc:creator>
      <dc:date>2022-08-25T15:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to get split graph with labels on the bars</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/830543#M328178</link>
      <description>&lt;P&gt;How about this one ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
picture fmt
low-&amp;lt;0='000%' (mult=100)
0-high='000%' (mult=100)
;
value fmt_freq
1='Rarely'
2='Occasion'
3='Frequent'
4='Almost Constantly'
;
run;


data have;
infile cards truncover;
input visit freq low high n_one n_zero p_zero p_one  n1 n2 p1 p2 p1_p p2_p zero text $40.;
label n1='N' n2='N' p1='Patients Without Symp(%)' p2='Patients Without Symp(%)';
format  freq fmt_freq. low high fmt.  p1 p2 percent8.0;
if high&amp;lt;=0 then do;high=high-0.1;low=low-0.1;end;
if low&amp;gt;=0 then do;high=high+0.1;low=low+0.1;end;
cards;
-0.5 1 -0.5 -0.4  -1.1 -0.1 0.1 1.1 81 47  0.88 0.79 -0.9 0.9 0 Before Treatment
-0.5 2 -0.4 -0.2   
-0.5 3 -0.2 -0.12
-0.5 4 -0.12 0
-0.5 1  0.4 0.6
-0.5 2  0.3 0.4
-0.5 3  0.1  0.3
-0.5 4  0 0.1
1 1 -0.2 -0.1  -1.1 -0.1 0.1 1.1 86 37 0.9 0.68  -0.9 0.9 0 Week1
1 2 -0.1 0     
1 1 0.2 0.4
1 2 0 0.2
2 3 -0.4 -0.3 -1.1 -0.1 0.1 1.1 89 48 0.93 0.73  -0.9 0.9 0 Week2
2 4 -0.3 0     
2 3  0.3 0.4
2 4  0 0.3
3 2 -0.4 -0.1 -1.1 -0.1 0.1 1.1 92 49 0.96 0.9  -0.9 0.9 0 Week3
3 4 -0.1 0     
3 2  0.1 0.2
3 4  0 0.1
4 1 -0.4 -0.3 -1.1 -0.1 0.1 1.1 81 41  0.94 0.9  -0.9 0.9 0 Week4
4 2 -0.3 -0.2  
4 3 -0.2 -0.1
4 4 -0.1 0
4 1  0.3 0.4
4 2  0.2 0.3
4 3  0.1 0.2
4 4  0 0.1
5 2 -0.3 -0.2 -1.1 -0.1 0.1 1.1 82 37 0.93 0.74  -0.9 0.9 0 Week5
5 3 -0.2 0     
5 2  0.2 0.6
5 3  0  0.2
6 2 -0.1 0  -1.1 -0.1 0.1 1.1  91 40  0.89 0.78  -0.9 0.9 0 Week6
6 3 0 0.4    
;
proc sgplot data=have noborder;
title  'Tagrisson 80 mg                                    Chemotherapy ';
styleattrs datacolors=( yellow orange navy verylightblue) ;
highlow y=visit low=n_one high=n_zero/type=bar fillattrs=(color=verydarkgreen)
nooutline transparency=0.8 name='n' legendlabel='Never';
highlow y=visit low=p_zero high=p_one/type=bar fillattrs=(color=verydarkgreen)
nooutline transparency=0.8;

highlow y=visit low=low high=high/type=bar group=freq nooutline name='a';

scatter y=visit x=p1_p/markerchar=p1 markercharattrs=(size=8) x2axis;
scatter y=visit x=p2_p/markerchar=p2 markercharattrs=(size=8) x2axis;

text y=visit x=zero text=text/strip contributeoffsets=none splitchar=' ' splitpolicy=splitalways textattrs=(size=8);

yaxistable n1/y=visit location=outside position=left valueattrs=(size=8 ) VALUEJUSTIFY=right VALUEHALIGN=right ;
yaxistable n2/y=visit location=outside position=right valueattrs=(size=8) VALUEJUSTIFY=left VALUEHALIGN=left;

xaxis values=(-1.1 to 1.1 by 0.2) display=(nolabel noline) valuesdisplay=(
'100%' '80%' '60%' '40%' '20%' '0%'  '0%' '20%' '40%' '60%' '80%' '100%') offsetmin=0 offsetmax=0 ;
x2axis values=(-1 -0.7 0 0.7 1) display=(nolabel noline noticks) valuesdisplay=(
' '  'Patients Without Symp(%)' ' '  'Patients Without Symp(%)'  ' ') offsetmin=0 offsetmax=0 ;

yaxis reverse display=none ;
keylegend 'n' 'a' /title='Frequency:';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1661514378916.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/74745i09F726ADF2E94913/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1661514378916.png" alt="Ksharp_0-1661514378916.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 11:46:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/830543#M328178</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-08-26T11:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to get split graph with labels on the bars</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/830552#M328183</link>
      <description>Thanks a lot Ksharp, this is exactly what i am looking for</description>
      <pubDate>Fri, 26 Aug 2022 12:28:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/830552#M328183</guid>
      <dc:creator>Ravindra_</dc:creator>
      <dc:date>2022-08-26T12:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to get split graph with labels on the bars</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/831386#M328516</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp; I had tried the above example that was given and applied to my data and i am not sure where i am missing can you please help me, the below is the code that i had written and the data i had used&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table ADQS4 as 
select USUBJID,PARAM, PARAML,TYPEAE,VISLBL,TRTPN,AVALC,AVAL, strip(put(AVAL,8.)) as AVAL_c from ANA.ADQS4 
where pepfl="Y" and RANDFL='Y' /*and PARAML='Vomiting (10)'*/ AND TYPEAE NE 'Composite' AND AVISITN NOT IN(1301,1401);
quit;

/*with vomiting*/

proc sort data=ADQS4 out=ADQS4_vom;
by VISLBL TRTPN;
where paraml='Vomiting (10)';
run;

proc freq data=ADQS4_vom;
by VISLBL;
tables AVAL_c*TRTPN/out=ADQS4_out;
run;

proc sort data=ADQS4_out;
by VISLBL aval_c TRTPN;
run;

proc transpose data=ADQS4_out out=ADQS4_out_trans(drop= _label_);
by VISLBL aval_c TRTPN;
var  COUNT PERCENT;
run;

/*subsetting the trt*/
data trt1(rename=(col1=trt1)) trt2(rename=(col1=trt2));
set ADQS4_out_trans;
if TRTPN=1 then output trt1;
if TRTPN=2 then output trt2;
run;

/*subsetting the trt to get count and percent*/

proc sort data=trt1;
by VISLBL aval_c;
run;

proc transpose data=trt1 out=trt1_trans(drop=_name_ );
by VISLBL aval_c ;
var  trt1;
run;

data trt1_trans1;
set trt1_trans;
if aval_c = . then delete;
rename COUNT=n1
       percent=p1;
run;
/*trt2*/
proc sort data=trt2;
by VISLBL aval_c;
run;

proc transpose data=trt2 out=trt2_trans(drop=_name_ );
by VISLBL aval_c ;
var  trt2;
run;

data trt2_trans1;
set trt2_trans;
if aval_c = . then delete;
rename COUNT=n2
       percent=p2;
run;

proc sort data=trt1_trans1;
by  VISLBL aval_c ;
run;
proc sort data=trt2_trans1;
by  VISLBL aval_c ;
run;

data trt1_merge;
length aval $20.;
merge trt1_trans1 trt2_trans1;
by VISLBL aval_c ;
if aval_c='0' then aval='Not at all';
if aval_c='1' then aval='Rarely';
if aval_c='2' then aval='Occasionaly';
if aval_c='3' then aval='Frequently';
if aval_c='4' then aval='Almost Constantly';
run;


/*without vomiting*/
proc sort data=ADQS4 out=ADQS4_vom_tot;
by VISLBL;
run;

proc means data=ADQS4_vom_tot noprint;
 class VISLBL AVAL_c/groupinternal;
 var AVAL;
 output out=class_summary;
run;

proc summary data=ADQS4_vom_tot();
 class VISLBL TRTPN;
 var AVAL;
 output out=stats max=AVAL_max min=aval_min;
run;

proc freq data=ADQS4_vom_tot;
by VISLBL;
tables AVAL_c*TRTPN/out=ADQS4_out_tot;
run;

proc sort data=ADQS4_out_tot;
by VISLBL aval_c TRTPN;
run;

proc transpose data=ADQS4_out_tot out=ADQS4_out_trans_tot(drop= _label_);
by VISLBL aval_c TRTPN;
var  COUNT PERCENT;
run;

/*subsetting the trt*/
data trt1_tot(rename=(col1=trt1)) trt2_tot(rename=(col1=trt2));
set ADQS4_out_trans_tot;
if TRTPN=1 then output trt1_tot;
if TRTPN=2 then output trt2_tot;
run;

/*subsetting the trt to get count and percent*/

proc sort data=trt1_tot;
by VISLBL aval_c;
run;

proc transpose data=trt1_tot out=trt1_trans_tot(drop=_name_ );
by VISLBL aval_c ;
var  trt1;
run;

data trt1_trans1_tot;
set trt1_trans_tot;
if aval_c = . then delete;
rename COUNT=n_zero
       percent=p_zero;
run;
/*trt2*/
proc sort data=trt2_tot;
by VISLBL aval_c;
run;

proc transpose data=trt2_tot out=trt2_trans_tot(drop=_name_ );
by VISLBL aval_c ;
var  trt2;
run;

data trt2_trans1_tot;
set trt2_trans_tot;
if aval_c = . then delete;
rename COUNT=n_one
       percent=p_one;
run;

proc sort data=trt1_trans1_tot;
by  VISLBL aval_c ;
run;
proc sort data=trt2_trans1_tot;
by  VISLBL aval_c ;
run;

data trt2_merge;
length aval $20.;
merge trt1_trans1_tot trt2_trans1_tot;
by VISLBL aval_c ;
if aval_c='0' then aval='Not at all';
if aval_c='1' then aval='Rarely';
if aval_c='2' then aval='Occasionaly';
if aval_c='3' then aval='Frequently';
if aval_c='4' then aval='Almost Constantly';
run;
*********************************************;
proc sort data=trt2_merge;
by VISLBL aval ;
run;
proc sort data=trt1_merge;
by VISLBL aval ;
run;

data final(drop=aval_c);
merge trt1_merge trt2_merge;
by VISLBL aval ;
run;

/*calculating min and max percentage*/
proc sql;
create table final_tot as
select *, sum(n_zero) as sum_ea, min(n_zero) as min, max(n_zero) as max
from final
group by VISLBL,aval 
;

proc sort data = final_tot out = final_tot1 nodupkey;
by VISLBL sum_ea;
run;

proc sql;
create table final_tot1 as
select *, sum_ea / sum(sum_ea) * 100 as sum_percent, 
          min / sum(sum_ea) * 100 as low,
		  max / sum(sum_ea) * 100 as high
from final_tot
group by aval;
quit;

data final_g;
set final_tot1;
p1_p=-0.9;
p2_p=0.9;
zero=0;
if high&amp;lt;=0 then do;high=high-0.1;low=low-0.1;end;
if low&amp;gt;=0 then do;high=high+0.1;low=low+0.1;end;
label n1='N' n2='N' p1='Patients Without Symp(%)' p2='Patients Without Symp(%)';
if vislbl='Baseline' then visit=-0.5;
if vislbl='Cycle 2' then visit=1;
if vislbl='Cycle 3' then visit=2;
if vislbl='Cycle 4' then visit=3;
if vislbl='Cycle 5' then visit=4;
if vislbl='Cycle 6' then visit=5;
if vislbl='Cycle 7' then visit=6;
if vislbl='Cycle 8' then visit=7;
if vislbl='Cycle 9' then visit=8;
if vislbl='Cycle 10' then visit=9;
if vislbl='Cycle 11' then visit=10;
if vislbl='Cycle 12' then visit=11;
if vislbl='Cycle 13' then visit=12;
if vislbl='Cycle 14' then visit=13;
if vislbl='Cycle 15' then visit=14;
if vislbl='Cycle 16' then visit=15;
;
rename aval =freq
       VISLBL=text;
run;

proc sort data=final_g;
by text freq;
run;

/*generaing graph*/
proc sgplot data=final_g noborder;
title  'Xenutuzumab with E+E                                    Placebo with E+E ';
styleattrs datacolors=( yellow orange navy verylightblue) ;
highlow y=visit low=n_one high=n_zero/type=bar fillattrs=(color=verydarkgreen)
nooutline transparency=0.8 name='n' legendlabel='Never';
highlow y=visit low=p_zero high=p_one/type=bar fillattrs=(color=verydarkgreen)
nooutline transparency=0.8;

highlow y=visit low=low high=high/type=bar group=freq nooutline name='a';

scatter y=visit x=p1_p/markerchar=p1 markercharattrs=(size=8) x2axis;
scatter y=visit x=p2_p/markerchar=p2 markercharattrs=(size=8) x2axis;

text y=visit x=zero text=text/strip contributeoffsets=none splitchar=' ' splitpolicy=splitalways textattrs=(size=8);

yaxistable n1/y=visit location=outside position=left valueattrs=(size=8 ) VALUEJUSTIFY=right VALUEHALIGN=right ;
yaxistable n2/y=visit location=outside position=right valueattrs=(size=8) VALUEJUSTIFY=left VALUEHALIGN=left;

xaxis values=(-1.1 to 1.1 by 0.2) display=(nolabel noline) valuesdisplay=(
'100%' '80%' '60%' '40%' '20%' '0%'  '0%' '20%' '40%' '60%' '80%' '100%') offsetmin=0 offsetmax=0 ;
x2axis values=(-1 -0.7 0 0.7 1) display=(nolabel noline noticks) valuesdisplay=(
' '  'Patients Without Symp(%)' ' '  'Patients Without Symp(%)'  ' ') offsetmin=0 offsetmax=0 ;

yaxis reverse display=none ;
keylegend 'n' 'a' /title='Frequency:';
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;the below is the data&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;USUBJID	PARAML	VISLBL	TRTPN	AVALC	AVAL	AVAL_c
1280-0022-1036002001	Difficulty Swallowing (02)	Baseline	2	NONE	0	0
1280-0022-1036002001	Difficulty Swallowing (02)	Cycle 2	2	NONE	0	0
1280-0022-1036002001	Difficulty Swallowing (02)	Cycle 3	2	NONE	0	0
1280-0022-1036002001	Difficulty Swallowing (02)	Cycle 4	2	NONE	0	0
1280-0022-1036002001	Difficulty Swallowing (02)	Cycle 5	2		.	.
1280-0022-1036002001	Difficulty Swallowing (02)	Cycle 6	2	NONE	0	0
1280-0022-1036002001	Difficulty Swallowing (02)	Cycle 7	2		.	.
1280-0022-1036002001	Difficulty Swallowing (02)	Cycle 8	2	NONE	0	0
1280-0022-1036002001	Difficulty Swallowing (02)	Cycle 9	2	NONE	0	0
1280-0022-1036002001	Difficulty Swallowing (02)	Cycle 10	2	NONE	0	0
1280-0022-1036002001	Difficulty Swallowing (02)	Cycle 11	2	NONE	0	0
1280-0022-1036002001	Difficulty Swallowing (02)	Cycle 12	2	NONE	0	0
1280-0022-1036002001	Skin Cracking Corners Mouth (04)	Baseline	2	NONE	0	0
1280-0022-1036002001	Skin Cracking Corners Mouth (04)	Cycle 2	2	MILD	1	1
1280-0022-1036002001	Skin Cracking Corners Mouth (04)	Cycle 3	2	NONE	0	0
1280-0022-1036002001	Skin Cracking Corners Mouth (04)	Cycle 4	2	NONE	0	0
1280-0022-1036002001	Skin Cracking Corners Mouth (04)	Cycle 5	2		.	.
1280-0022-1036002001	Skin Cracking Corners Mouth (04)	Cycle 6	2	NONE	0	0
1280-0022-1036002001	Skin Cracking Corners Mouth (04)	Cycle 7	2		.	.
1280-0022-1036002001	Skin Cracking Corners Mouth (04)	Cycle 8	2	MILD	1	1
1280-0022-1036002001	Skin Cracking Corners Mouth (04)	Cycle 9	2	NONE	0	0
1280-0022-1036002001	Skin Cracking Corners Mouth (04)	Cycle 10	2	NONE	0	0
1280-0022-1036002001	Skin Cracking Corners Mouth (04)	Cycle 11	2	NONE	0	0
1280-0022-1036002001	Skin Cracking Corners Mouth (04)	Cycle 12	2	NONE	0	0
1280-0022-1036002001	Decreased Appetite at Worst (08)	Baseline	2	NONE	0	0
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 2	2	MILD	1	1
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 3	2	NONE	0	0
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 4	2	NONE	0	0
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 5	2		.	.
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 6	2	MILD	1	1
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 7	2		.	.
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 8	2	MODERTATE	2	2
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 9	2	MILD	1	1
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 10	2	NONE	0	0
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 11	2	NONE	0	0
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 12	2	MILD	1	1
1280-0022-1036002001	Decreased Appetite at Worst (08)	Baseline	2	NOT AT ALL	0	0
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 2	2	NOT AT ALL	0	0
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 3	2	NOT AT ALL	0	0
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 4	2	NOT AT ALL	0	0
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 5	2		.	.
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 6	2	A LITTLE BIT	1	1
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 7	2		.	.
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 8	2	A LITTLE BIT	1	1
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 9	2	NOT AT ALL	0	0
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 10	2	NOT AT ALL	0	0
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 11	2		.	.
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 12	2	NOT AT ALL	0	0
1280-0022-1036002001	Vomiting (10)	Baseline	2	NEVER	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 2	2	NEVER	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 3	2	NEVER	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 4	2	NEVER	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 5	2		.	.
1280-0022-1036002001	Vomiting (10)	Cycle 6	2	NEVER	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 7	2		.	.
1280-0022-1036002001	Vomiting (10)	Cycle 8	2	RARELY	1	1
1280-0022-1036002001	Vomiting (10)	Cycle 9	2	NEVER	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 10	2	NEVER	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 11	2	NEVER	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 12	2	NEVER	0	0
1280-0022-1036002001	Vomiting (10)	Baseline	2	NONE	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 2	2	NONE	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 3	2	NONE	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 4	2	NONE	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 5	2		.	.
1280-0022-1036002001	Vomiting (10)	Cycle 6	2	NONE	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 7	2		.	.
1280-0022-1036002001	Vomiting (10)	Cycle 8	2	MILD	1	1
1280-0022-1036002001	Vomiting (10)	Cycle 9	2	NONE	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 10	2	NONE	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 11	2		.	.
1280-0022-1036002001	Vomiting (10)	Cycle 12	2		.	.
1280-0022-1036002001	Heartburn (11)	Baseline	2	NEVER	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 2	2	NEVER	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 3	2	NEVER	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 4	2	NEVER	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 5	2		.	.
1280-0022-1036002001	Heartburn (11)	Cycle 6	2	NEVER	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 7	2		.	.
1280-0022-1036002001	Heartburn (11)	Cycle 8	2	NEVER	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 9	2	NEVER	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 10	2	NEVER	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 11	2	NEVER	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 12	2	NEVER	0	0
1280-0022-1036002001	Heartburn (11)	Baseline	2	NONE	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 2	2	NONE	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 3	2	NONE	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 4	2	NONE	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 5	2		.	.
1280-0022-1036002001	Heartburn (11)	Cycle 6	2	NONE	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 7	2		.	.
1280-0022-1036002001	Heartburn (11)	Cycle 8	2	NONE	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 9	2	NONE	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 10	2	NONE	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 11	2		.	.
1280-0022-1036002001	Heartburn (11)	Cycle 12	2		.	.
1280-0022-1036002001	Diarrhoea (16)	Baseline	2	NEVER	0	0
1280-0022-1036002001	Diarrhoea (16)	Cycle 2	2	OCCASIONALLY	2	2
1280-0022-1036002001	Diarrhoea (16)	Cycle 3	2	NEVER	0	0
1280-0022-1036002001	Diarrhoea (16)	Cycle 4	2	NEVER	0	0
1280-0022-1036002001	Diarrhoea (16)	Cycle 5	2		.	.
1280-0022-1036002001	Diarrhoea (16)	Cycle 6	2	RARELY	1	1
1280-0022-1036002001	Diarrhoea (16)	Cycle 7	2		.	.
1280-0022-1036002001	Diarrhoea (16)	Cycle 8	2	FREQUENTLY	3	3
1280-0022-1036002001	Diarrhoea (16)	Cycle 9	2	NEVER	0	0
1280-0022-1036002001	Diarrhoea (16)	Cycle 10	2	NEVER	0	0
1280-0022-1036002001	Diarrhoea (16)	Cycle 11	2	NEVER	0	0
1280-0022-1036002001	Diarrhoea (16)	Cycle 12	2	NEVER	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Baseline	2	NEVER	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 2	2	NEVER	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 3	2	NEVER	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 4	2	NEVER	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 5	2		.	.
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 6	2	NEVER	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 7	2		.	.
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 8	2	NEVER	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 9	2	NEVER	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 10	2	NEVER	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 11	2	NEVER	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 12	2	NEVER	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Baseline	2	NONE	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 2	2	NONE	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 3	2	NONE	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 4	2	NONE	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 5	2		.	.
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 6	2	NONE	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 7	2		.	.
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 8	2	NONE	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 9	2	NONE	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 10	2	NONE	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 11	2	NONE	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 12	2		.	.
1280-0022-1036002001	Pain in Abdomen (17)	Baseline	2	NOT AT ALL	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 2	2	NOT AT ALL	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 3	2	NOT AT ALL	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 4	2	NOT AT ALL	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 5	2		.	.
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 6	2	NOT AT ALL	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 7	2		.	.
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 8	2	NOT AT ALL	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 9	2	NOT AT ALL	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 10	2	NOT AT ALL	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 11	2		.	.
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 12	2		.	.
1280-0022-1036002001	Rash (23)	Baseline	2	N	0	0
1280-0022-1036002001	Rash (23)	Cycle 2	2	N	0	0
1280-0022-1036002001	Rash (23)	Cycle 3	2	N	0	0
1280-0022-1036002001	Rash (23)	Cycle 4	2	N	0	0
1280-0022-1036002001	Rash (23)	Cycle 5	2		.	.
1280-0022-1036002001	Rash (23)	Cycle 6	2	N	0	0
1280-0022-1036002001	Rash (23)	Cycle 7	2		.	.
1280-0022-1036002001	Rash (23)	Cycle 8	2	N	0	0
1280-0022-1036002001	Rash (23)	Cycle 9	2	N	0	0
1280-0022-1036002001	Rash (23)	Cycle 10	2	N	0	0
1280-0022-1036002001	Rash (23)	Cycle 11	2	N	0	0
1280-0022-1036002001	Rash (23)	Cycle 12	2	N	0	0
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;can you please guide me where i am missing.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 11:15:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/831386#M328516</guid>
      <dc:creator>Ravindra_</dc:creator>
      <dc:date>2022-09-01T11:15:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to get split graph with labels on the bars</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/831404#M328524</link>
      <description>&lt;P&gt;I don't know how to distinguish LEFT or RIGHT value by you .&lt;/P&gt;
&lt;P&gt;If you could organize your data very well as HAVE dataset of mine . you would get the result.&lt;/P&gt;
&lt;P&gt;Here is an example. I have no time to finish all these .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards expandtabs truncover;
input (USUBJID	PARAML	VISLBL	TRTPN	AVALC	AVAL	AVAL_c) (&amp;amp; $40.);

freq=input(scan(PARAML,-1,'() '),best.);

if vislbl=:'Baseline' then visit=-0.5;
if vislbl=:'Cycle 2' then visit=1;
if vislbl=:'Cycle 3' then visit=2;
if vislbl=:'Cycle 4' then visit=3;
if vislbl=:'Cycle 5' then visit=4;
if vislbl=:'Cycle 6' then visit=5;
if vislbl=:'Cycle 7' then visit=6;
if vislbl=:'Cycle 8' then visit=7;
if vislbl=:'Cycle 9' then visit=8;
if vislbl=:'Cycle 10' then visit=9;
if vislbl=:'Cycle 11' then visit=10;
if vislbl=:'Cycle 12' then visit=11;
if vislbl=:'Cycle 13' then visit=12;
if vislbl=:'Cycle 14' then visit=13;
if vislbl=:'Cycle 15' then visit=14;
if vislbl=:'Cycle 16' then visit=15;

keep visit freq;
cards;
1280-0022-1036002001	Difficulty Swallowing (02)	Baseline	2	NONE	0	0
1280-0022-1036002001	Difficulty Swallowing (02)	Cycle 2	2	NONE	0	0
1280-0022-1036002001	Difficulty Swallowing (02)	Cycle 3	2	NONE	0	0
1280-0022-1036002001	Difficulty Swallowing (02)	Cycle 4	2	NONE	0	0
1280-0022-1036002001	Difficulty Swallowing (02)	Cycle 5	2		.	.
1280-0022-1036002001	Difficulty Swallowing (02)	Cycle 6	2	NONE	0	0
1280-0022-1036002001	Difficulty Swallowing (02)	Cycle 7	2		.	.
1280-0022-1036002001	Difficulty Swallowing (02)	Cycle 8	2	NONE	0	0
1280-0022-1036002001	Difficulty Swallowing (02)	Cycle 9	2	NONE	0	0
1280-0022-1036002001	Difficulty Swallowing (02)	Cycle 10	2	NONE	0	0
1280-0022-1036002001	Difficulty Swallowing (02)	Cycle 11	2	NONE	0	0
1280-0022-1036002001	Difficulty Swallowing (02)	Cycle 12	2	NONE	0	0
1280-0022-1036002001	Skin Cracking Corners Mouth (04)	Baseline	2	NONE	0	0
1280-0022-1036002001	Skin Cracking Corners Mouth (04)	Cycle 2	2	MILD	1	1
1280-0022-1036002001	Skin Cracking Corners Mouth (04)	Cycle 3	2	NONE	0	0
1280-0022-1036002001	Skin Cracking Corners Mouth (04)	Cycle 4	2	NONE	0	0
1280-0022-1036002001	Skin Cracking Corners Mouth (04)	Cycle 5	2		.	.
1280-0022-1036002001	Skin Cracking Corners Mouth (04)	Cycle 6	2	NONE	0	0
1280-0022-1036002001	Skin Cracking Corners Mouth (04)	Cycle 7	2		.	.
1280-0022-1036002001	Skin Cracking Corners Mouth (04)	Cycle 8	2	MILD	1	1
1280-0022-1036002001	Skin Cracking Corners Mouth (04)	Cycle 9	2	NONE	0	0
1280-0022-1036002001	Skin Cracking Corners Mouth (04)	Cycle 10	2	NONE	0	0
1280-0022-1036002001	Skin Cracking Corners Mouth (04)	Cycle 11	2	NONE	0	0
1280-0022-1036002001	Skin Cracking Corners Mouth (04)	Cycle 12	2	NONE	0	0
1280-0022-1036002001	Decreased Appetite at Worst (08)	Baseline	2	NONE	0	0
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 2	2	MILD	1	1
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 3	2	NONE	0	0
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 4	2	NONE	0	0
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 5	2		.	.
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 6	2	MILD	1	1
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 7	2		.	.
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 8	2	MODERTATE	2	2
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 9	2	MILD	1	1
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 10	2	NONE	0	0
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 11	2	NONE	0	0
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 12	2	MILD	1	1
1280-0022-1036002001	Decreased Appetite at Worst (08)	Baseline	2	NOT AT ALL	0	0
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 2	2	NOT AT ALL	0	0
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 3	2	NOT AT ALL	0	0
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 4	2	NOT AT ALL	0	0
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 5	2		.	.
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 6	2	A LITTLE BIT	1	1
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 7	2		.	.
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 8	2	A LITTLE BIT	1	1
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 9	2	NOT AT ALL	0	0
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 10	2	NOT AT ALL	0	0
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 11	2		.	.
1280-0022-1036002001	Decreased Appetite at Worst (08)	Cycle 12	2	NOT AT ALL	0	0
1280-0022-1036002001	Vomiting (10)	Baseline	2	NEVER	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 2	2	NEVER	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 3	2	NEVER	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 4	2	NEVER	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 5	2		.	.
1280-0022-1036002001	Vomiting (10)	Cycle 6	2	NEVER	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 7	2		.	.
1280-0022-1036002001	Vomiting (10)	Cycle 8	2	RARELY	1	1
1280-0022-1036002001	Vomiting (10)	Cycle 9	2	NEVER	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 10	2	NEVER	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 11	2	NEVER	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 12	2	NEVER	0	0
1280-0022-1036002001	Vomiting (10)	Baseline	2	NONE	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 2	2	NONE	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 3	2	NONE	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 4	2	NONE	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 5	2		.	.
1280-0022-1036002001	Vomiting (10)	Cycle 6	2	NONE	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 7	2		.	.
1280-0022-1036002001	Vomiting (10)	Cycle 8	2	MILD	1	1
1280-0022-1036002001	Vomiting (10)	Cycle 9	2	NONE	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 10	2	NONE	0	0
1280-0022-1036002001	Vomiting (10)	Cycle 11	2		.	.
1280-0022-1036002001	Vomiting (10)	Cycle 12	2		.	.
1280-0022-1036002001	Heartburn (11)	Baseline	2	NEVER	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 2	2	NEVER	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 3	2	NEVER	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 4	2	NEVER	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 5	2		.	.
1280-0022-1036002001	Heartburn (11)	Cycle 6	2	NEVER	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 7	2		.	.
1280-0022-1036002001	Heartburn (11)	Cycle 8	2	NEVER	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 9	2	NEVER	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 10	2	NEVER	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 11	2	NEVER	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 12	2	NEVER	0	0
1280-0022-1036002001	Heartburn (11)	Baseline	2	NONE	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 2	2	NONE	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 3	2	NONE	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 4	2	NONE	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 5	2		.	.
1280-0022-1036002001	Heartburn (11)	Cycle 6	2	NONE	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 7	2		.	.
1280-0022-1036002001	Heartburn (11)	Cycle 8	2	NONE	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 9	2	NONE	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 10	2	NONE	0	0
1280-0022-1036002001	Heartburn (11)	Cycle 11	2		.	.
1280-0022-1036002001	Heartburn (11)	Cycle 12	2		.	.
1280-0022-1036002001	Diarrhoea (16)	Baseline	2	NEVER	0	0
1280-0022-1036002001	Diarrhoea (16)	Cycle 2	2	OCCASIONALLY	2	2
1280-0022-1036002001	Diarrhoea (16)	Cycle 3	2	NEVER	0	0
1280-0022-1036002001	Diarrhoea (16)	Cycle 4	2	NEVER	0	0
1280-0022-1036002001	Diarrhoea (16)	Cycle 5	2		.	.
1280-0022-1036002001	Diarrhoea (16)	Cycle 6	2	RARELY	1	1
1280-0022-1036002001	Diarrhoea (16)	Cycle 7	2		.	.
1280-0022-1036002001	Diarrhoea (16)	Cycle 8	2	FREQUENTLY	3	3
1280-0022-1036002001	Diarrhoea (16)	Cycle 9	2	NEVER	0	0
1280-0022-1036002001	Diarrhoea (16)	Cycle 10	2	NEVER	0	0
1280-0022-1036002001	Diarrhoea (16)	Cycle 11	2	NEVER	0	0
1280-0022-1036002001	Diarrhoea (16)	Cycle 12	2	NEVER	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Baseline	2	NEVER	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 2	2	NEVER	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 3	2	NEVER	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 4	2	NEVER	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 5	2		.	.
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 6	2	NEVER	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 7	2		.	.
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 8	2	NEVER	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 9	2	NEVER	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 10	2	NEVER	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 11	2	NEVER	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 12	2	NEVER	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Baseline	2	NONE	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 2	2	NONE	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 3	2	NONE	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 4	2	NONE	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 5	2		.	.
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 6	2	NONE	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 7	2		.	.
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 8	2	NONE	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 9	2	NONE	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 10	2	NONE	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 11	2	NONE	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 12	2		.	.
1280-0022-1036002001	Pain in Abdomen (17)	Baseline	2	NOT AT ALL	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 2	2	NOT AT ALL	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 3	2	NOT AT ALL	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 4	2	NOT AT ALL	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 5	2		.	.
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 6	2	NOT AT ALL	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 7	2		.	.
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 8	2	NOT AT ALL	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 9	2	NOT AT ALL	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 10	2	NOT AT ALL	0	0
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 11	2		.	.
1280-0022-1036002001	Pain in Abdomen (17)	Cycle 12	2		.	.
1280-0022-1036002001	Rash (23)	Baseline	2	N	0	0
1280-0022-1036002001	Rash (23)	Cycle 2	2	N	0	0
1280-0022-1036002001	Rash (23)	Cycle 3	2	N	0	0
1280-0022-1036002001	Rash (23)	Cycle 4	2	N	0	0
1280-0022-1036002001	Rash (23)	Cycle 5	2		.	.
1280-0022-1036002001	Rash (23)	Cycle 6	2	N	0	0
1280-0022-1036002001	Rash (23)	Cycle 7	2		.	.
1280-0022-1036002001	Rash (23)	Cycle 8	2	N	0	0
1280-0022-1036002001	Rash (23)	Cycle 9	2	N	0	0
1280-0022-1036002001	Rash (23)	Cycle 10	2	N	0	0
1280-0022-1036002001	Rash (23)	Cycle 11	2	N	0	0
1280-0022-1036002001	Rash (23)	Cycle 12	2	N	0	0
;

proc sort data=have;by visit freq;run;
data have;
 set have;
 by visit freq;
 left=first.freq ;
run;

proc sql;
create table have2 as
select visit,left,freq,
count(*)/(select count(*) from have where  left=a.left) as pct
 from have  as a
  group by visit,left,freq ;
quit;
data have3;
 set have2;
 by visit left;
 if first.left then cum=0;
 cum+pct;
 run;
data have4;
 set have3;
 if left then cum=-cum;
run;
data have5;
 set have4;
 by visit left;
 lag_cum=lag(cum);
 if first.left then lag_cum=0;
 drop pct;
run;
data  have6;
 set have5;
 if left then do;high=lag_cum;low=cum;end;
 else do;high=cum;low=lag_cum;end;
 drop cum lag_cum;
run;

proc format;
value fmt_freq
2='Rarely'
4='Occasion'
8='Frequent'
10='Almost Constantly'
11='Almost 1'
16='Almost 2'
17='Almost 3'
23='Almost 4'

;
run;

data have7;
 set have6;
 by visit;
if first.visit then do;
n_one=-1.1;
n_zero=-0.1;
p_zero=0.1;
p_one=1.1;
p1_p=-0.9; 
p2_p=0.9; 
zero=0;
select(visit);
when(-0.5) text='Baseline';
when(1)  text='Cycle 1';
when(2)  text='Cycle 2';
when(3)  text='Cycle 3';
when(4)  text='Cycle 4';
when(5)  text='Cycle 5';
when(6)  text='Cycle 6';
when(7)  text='Cycle 7';
when(8)  text='Cycle 8';
when(9)  text='Cycle 9';
when(10) text='Cycle 10';
when(11) text='Cycle 11';
when(12) text='Cycle 12';
when(13) text='Cycle 13';
when(14) text='Cycle 14';
when(15) text='Cycle 15';
when(16) text='Cycle 16';
otherwise;
end;
end;

format  freq fmt_freq. ;
if high&amp;lt;=0 then do;high=high-0.1;low=low-0.1;end;
if low&amp;gt;=0 then do;high=high+0.1;low=low+0.1;end;
run;

proc sgplot data=have7 noborder;
title  'Tagrisson 80 mg                                    Chemotherapy ';
styleattrs datacolors=( yellow orange navy verylightblue) ;
highlow y=visit low=n_one high=n_zero/type=bar fillattrs=(color=verydarkgreen)
nooutline transparency=0.8 name='n' legendlabel='Never';
highlow y=visit low=p_zero high=p_one/type=bar fillattrs=(color=verydarkgreen)
nooutline transparency=0.8;

highlow y=visit low=low high=high/type=bar group=freq nooutline name='a';

/*scatter y=visit x=p1_p/markerchar=p1 markercharattrs=(size=8) x2axis;*/
/*scatter y=visit x=p2_p/markerchar=p2 markercharattrs=(size=8) x2axis;*/

text y=visit x=zero text=text/strip contributeoffsets=none splitchar=' ' splitpolicy=splitalways textattrs=(size=8);

/*yaxistable n1/y=visit location=outside position=left valueattrs=(size=8 ) VALUEJUSTIFY=right VALUEHALIGN=right ;*/
/*yaxistable n2/y=visit location=outside position=right valueattrs=(size=8) VALUEJUSTIFY=left VALUEHALIGN=left;*/

xaxis values=(-1.1 to 1.1 by 0.2) display=(nolabel noline) valuesdisplay=(
'100%' '80%' '60%' '40%' '20%' '0%'  '0%' '20%' '40%' '60%' '80%' '100%') offsetmin=0 offsetmax=0 ;
x2axis values=(-1 -0.7 0 0.7 1) display=(nolabel noline noticks) valuesdisplay=(
' '  'Patients Without Symp(%)' ' '  'Patients Without Symp(%)'  ' ') offsetmin=0 offsetmax=0 ;

yaxis reverse display=none ;
keylegend 'n' 'a' /title='Frequency:';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1662038393785.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/74933iE6AECFEB4A82B0A5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1662038393785.png" alt="Ksharp_0-1662038393785.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 13:19:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/831404#M328524</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-09-01T13:19:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to get split graph with labels on the bars</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/831405#M328525</link>
      <description>thanks a lot for taking time during your busy hours, i will take it from here</description>
      <pubDate>Thu, 01 Sep 2022 13:29:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/831405#M328525</guid>
      <dc:creator>Ravindra_</dc:creator>
      <dc:date>2022-09-01T13:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to get split graph with labels on the bars</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/831407#M328526</link>
      <description>&lt;P&gt;If changing this percent.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
create table have2 as
select visit,left,freq,
count(*)/(select count(*) from have where  &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;visit=a.visit&lt;/STRONG&gt;&lt;/FONT&gt;) as pct
 from have  as a
  group by visit,left,freq ;
quit;&lt;/PRE&gt;
&lt;P&gt;Could get the following Graph.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1662039317820.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/74934i0DDFD8CA03599A3B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1662039317820.png" alt="Ksharp_0-1662039317820.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 13:35:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/831407#M328526</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-09-01T13:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to get split graph with labels on the bars</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/831878#M328789</link>
      <description>can i know how do we segregate this for treatment groups within same graph, as left side we need trt1 and right side we need trt2</description>
      <pubDate>Tue, 06 Sep 2022 06:50:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/831878#M328789</guid>
      <dc:creator>Ravindra_</dc:creator>
      <dc:date>2022-09-06T06:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to get split graph with labels on the bars</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/831885#M328791</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;The requirement is based on two treatment groups comparison and I had added my avalupdt variable in the group instead of freq as it is not giving me the desired output. Now the client requires separate output based on every param and i had tweaked your code slightly in the grouping to get the calculation based on aval, but not quite sure how do we segregate this between two treatment groups, as there no subgroup group available in sgplot. The below is my code that i had used. Can you please let me know where am i missing this.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
picture fmt
low-&amp;lt;0='000%' (mult=100)
0-high='000%' (mult=100)
;
value fmt_freq
1='Rarely'
2='Occasionaly'
3='Frequently'
4='Almost Constantly'
;
value $grade
'Severity'=1
'Frequency'=2
'Interference'=3
'Presence/Absence'=4
;
run;

proc sql;
create table ADQS4 as 
select USUBJID,PARAM, PARAML,TYPEAE,VISLBL,TRTPN,AVALC,AVALUPDT, strip(put(AVALUPDT,8.)) as AVAL_c,
input(scan(PARAML,-1,'() '),best.) as freq from ANA.ADQS4 
where pepfl="Y" and RANDFL='Y' /*and PARAML='Vomiting (10)'*/ 
AND TYPEAE NE 'Composite' AND AVISITN NOT IN(1301,1401) AND USUBJID EQ '1280-0022-1036002001';
quit;


data ADQS4_01;
set ADQS4;
if TYPEAE ='Severity' then type=1;
if TYPEAE ='Frequency' then type=2;
if TYPEAE ='Interference' then type=3;
if TYPEAE ='Presence/Absence' then type=4;
if freq=2 and TYPEAE ='Severity' then figno='01.01';
if freq=4 and TYPEAE ='Severity' then figno='01.02';
if freq=8 and TYPEAE ='Severity' then figno='01.03';
if freq=8 and TYPEAE ='Interference' then figno='01.04';
if freq=10 and TYPEAE ='Severity' then figno='01.05';
if freq=10 and TYPEAE ='Frequency' then figno='01.06';
if freq=11 and TYPEAE ='Severity' then figno='01.07';
if freq=11 and TYPEAE ='Frequency' then figno='01.08';
if freq=16 and TYPEAE ='Frequency' then figno='01.09';
if freq=17 and TYPEAE ='Severity' then figno='01.10';
if freq=17 and TYPEAE ='Frequency' then figno='01.11';
if freq=17 and TYPEAE ='Interference' then figno='01.12';
if freq=23 and TYPEAE ='Presence/Absence' then figno='01.13';

if vislbl='Baseline' then visit=-0.5;
if vislbl='Cycle 2' then visit=1;
if vislbl='Cycle 3' then visit=2;
if vislbl='Cycle 4' then visit=3;
if vislbl='Cycle 5' then visit=4;
if vislbl='Cycle 6' then visit=5;
if vislbl='Cycle 7' then visit=6;
if vislbl='Cycle 8' then visit=7;
if vislbl='Cycle 9' then visit=8;
if vislbl='Cycle 10' then visit=9;
if vislbl='Cycle 11' then visit=10;
if vislbl='Cycle 12' then visit=11;
if vislbl='Cycle 13' then visit=12;
if vislbl='Cycle 14' then visit=13;
if vislbl='Cycle 15' then visit=14;
if vislbl='Cycle 16' then visit=15;
run;

%macro graph(figno=,dsn=);

data ADQS4_1;
set ADQS4_01;
where figno=&amp;amp;figno.;
run;

proc sort data=ADQS4_1;by visit freq;run;
data ADQS4_1;
 set ADQS4_1;
 by visit freq;
 left=first.freq ;
run;

proc sql;
create table ADQS4_2 as
select visit,left,freq,AVALUPDT,
count(*)/(select count(*) from ADQS4_1 where  visit=a.visit) as pct
 from ADQS4_1  as a
  group by visit,left,freq,AVALUPDT;
quit;
data ADQS4_3;
 set ADQS4_2;
 by visit left;
 if first.left then cum=0;
 cum+pct;
 run;
data ADQS4_4;
 set ADQS4_3;
 if left then cum=-cum;
run;
data ADQS4_5;
 set ADQS4_4;
 by visit left AVALUPDT;
 lag_cum=lag(cum);
 if first.left then lag_cum=0;
 drop pct;
run;
data  ADQS4_6;
 set ADQS4_5;
 if left then do;high=lag_cum;low=cum;end;
 else do;high=cum;low=lag_cum;end;
 drop cum lag_cum;
run;

data final_&amp;amp;dsn.;
 set ADQS4_6;
 by visit;
if first.visit then do;
n_one=-1.1;
n_zero=-0.1;
p_zero=0.1;
p_one=1.1;
p1_p=-0.9; 
p2_p=0.9; 
zero=0;
select(visit);
when(-0.5) text='Baseline';
when(1)  text='Cycle 1';
when(2)  text='Cycle 2';
when(3)  text='Cycle 3';
when(4)  text='Cycle 4';
when(5)  text='Cycle 5';
when(6)  text='Cycle 6';
when(7)  text='Cycle 7';
when(8)  text='Cycle 8';
when(9)  text='Cycle 9';
when(10) text='Cycle 10';
when(11) text='Cycle 11';
when(12) text='Cycle 12';
when(13) text='Cycle 13';
when(14) text='Cycle 14';
when(15) text='Cycle 15';
when(16) text='Cycle 16';
otherwise;
end;
end;

figno=&amp;amp;figno.;
if high&amp;lt;=0 then do;high=high-0.1;low=low-0.1;end;
if low&amp;gt;=0 then do;high=high+0.1;low=low+0.1;end;
run;

%mend;

%graph(figno='01.01',dsn=G_1);
%graph(figno='01.02',dsn=G_2);
%graph(figno='01.03',dsn=G_3);
%graph(figno='01.04',dsn=G_4);
%graph(figno='01.05',dsn=G_5);
%graph(figno='01.06',dsn=G_6);
%graph(figno='01.07',dsn=G_7);
%graph(figno='01.08',dsn=G_8);
%graph(figno='01.09',dsn=G_9);
%graph(figno='01.10',dsn=G_10);
%graph(figno='01.11',dsn=G_11);
%graph(figno='01.12',dsn=G_12);
%graph(figno='01.13',dsn=G_13);

proc format;
value fmt_freq
2='Rarely'
4='Occasion'
8='Frequent'
10='Almost Constantly'
11='Almost 1'
16='Almost 2'
17='Almost 3'
23='Almost 4'

;
run;
proc format;
value fmt_fre
0='None'
1='Mild'
2='Moderate'
3='Severe'
4='Rarely'
5='Occassion'
;
run;

data final_g;
set final_g_:;
format  avalupdt fmt_fre. ;
run;


proc sort data=final_g out=ANAT.FIG01;
by figno text freq;
run;

/*generaing graph*/

options leftmargin = 1.5cm rightmargin = 1.5cm topmargin = 1.5cm bottommargin = 2.0cm
        formchar = '|----|+|---+=|-/&amp;lt;&amp;gt;*' nonumber nodate nocenter nomprint
        orientation=landscape papersize=A4 dev=PNG300;
goptions XPIXELS=0 YPIXELS=0;
ods graphics on / reset = all width = 25.6cm height = 15.4cm  noborder; 

ods pdf file = "&amp;amp;outpath\BI9009A_F01_PRO_CTCAE_Stacked_BAR_Chart_v1_0.pdf"
 	pdftoc=1 compress=9 uniform nopdfnote nogtitle nogfootnote dpi=300 ;

proc sgplot data=final_g noborder;
Where figNo = "&amp;amp;figNo";
title  'Xenutuzumab with E+E                                    Placebo with E+E ';
styleattrs datacolors=( yellow orange navy verylightblue) ;
highlow y=visit low=n_one high=n_zero/type=bar fillattrs=(color=verydarkgreen)
nooutline transparency=0.8 name='n' legendlabel='Never';
highlow y=visit low=p_zero high=p_one/type=bar fillattrs=(color=verydarkgreen)
nooutline transparency=0.8;

highlow y=visit low=low high=high/type=bar group=avalupdt nooutline name='a';

/*scatter y=visit x=p1_p/markerchar=p1 markercharattrs=(size=8) x2axis;*/
/*scatter y=visit x=p2_p/markerchar=p2 markercharattrs=(size=8) x2axis;*/

text y=visit x=zero text=text/strip contributeoffsets=none splitchar=' ' splitpolicy=splitalways textattrs=(size=8);

/*yaxistable n1/y=visit location=outside position=left valueattrs=(size=8 ) VALUEJUSTIFY=right VALUEHALIGN=right ;*/
/*yaxistable n2/y=visit location=outside position=right valueattrs=(size=8) VALUEJUSTIFY=left VALUEHALIGN=left;*/

xaxis values=(-1.1 to 1.1 by 0.2) display=(nolabel noline) valuesdisplay=(
'100%' '80%' '60%' '40%' '20%' '0%'  '0%' '20%' '40%' '60%' '80%' '100%') offsetmin=0 offsetmax=0 ;
x2axis values=(-1 -0.7 0 0.7 1) display=(nolabel noline noticks) valuesdisplay=(
' '  'Patients Without Symp(%)' ' '  'Patients Without Symp(%)'  ' ') offsetmin=0 offsetmax=0 ;

yaxis reverse display=none ;
keylegend 'n' 'a' /title='Frequency:';

ods pdf close;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I still can't figure out to get the number and percentage on the left and right side of the graph. I had tried to use this with sgpanel but not quite successful, some insights would be helpful please.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 08:28:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/831885#M328791</guid>
      <dc:creator>Ravindra_</dc:creator>
      <dc:date>2022-09-06T08:28:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to get split graph with labels on the bars</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/831906#M328806</link>
      <description>Here "LEFT" variable in my code is your treatment groups . You could create it by your own logic.</description>
      <pubDate>Tue, 06 Sep 2022 12:03:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/831906#M328806</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-09-06T12:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to get split graph with labels on the bars</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/831911#M328810</link>
      <description>Here &lt;BR /&gt;data ADQS4_1;&lt;BR /&gt; set ADQS4_1;&lt;BR /&gt; by visit freq;&lt;BR /&gt; left=first.freq ;&lt;BR /&gt;run;&lt;BR /&gt;This code is I just make an example to distinguish LEFT or RIGHT percent.  It is depend you how to make a LEFT variable, I don't know your logic as I mentioned in my post.</description>
      <pubDate>Tue, 06 Sep 2022 12:24:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/831911#M328810</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-09-06T12:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to get split graph with labels on the bars</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/831926#M328816</link>
      <description>&lt;PRE&gt;"Now the client requires separate output based on every param "
Can you post a picture to explain what you want to do  ?
If it is just a BAR graph ,that is very easy .

Here is an example:

libname x v9 'c:\temp';
proc sgpanel data=x.adqs4_01;
panelby PARAML/layout=columnlattice onepanel novarname;
hbar VISLBL/group=TYPEAE ;
run;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1662469636657.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75008iA859BAB803F712D5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1662469636657.png" alt="Ksharp_0-1662469636657.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 13:07:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/831926#M328816</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-09-06T13:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to get split graph with labels on the bars</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/833297#M329405</link>
      <description>&lt;P&gt;Thank you for the response, I had tweaked the code using the trtpn variable but not able to figure out where to resolve the issue with highlow values that is where i got stuck, i had given separate condition for both trt groups for high low values and its not working, is there any idea that you can give me here, the below is the modified code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc format;
picture fmt
low-&amp;lt;0='000%' (mult=100)
0-high='000%' (mult=100)
;
value fmt_freq
1='Rarely'
2='Occasionaly'
3='Frequently'
4='Almost Constantly'
;
value $grade
'Severity'=1
'Frequency'=2
'Interference'=3
'Presence/Absence'=4
;
run;

proc sql;
create table ADQS4 as 
select USUBJID,PARAM, PARAML,TYPEAE,VISLBL,TRTPN,AVALC,AVALUPDT, strip(put(AVALUPDT,8.)) as AVAL_c,
input(scan(PARAML,-1,'() '),best.) as freq from ANA.ADQS4 
where pepfl="Y" and RANDFL='Y' /*and PARAML='Vomiting (10)'*/ 
AND TYPEAE NE 'Composite' AND AVISITN NOT IN(1301,1401) /*AND USUBJID EQ '1280-0022-1036002001'*/;
quit;


data ADQS4_01;
set ADQS4;
if TYPEAE ='Severity' then type=1;
if TYPEAE ='Frequency' then type=2;
if TYPEAE ='Interference' then type=3;
if TYPEAE ='Presence/Absence' then type=4;
if freq=2 and TYPEAE ='Severity' then figno='01.01';
if freq=4 and TYPEAE ='Severity' then figno='01.02';
if freq=8 and TYPEAE ='Severity' then figno='01.03';
if freq=8 and TYPEAE ='Interference' then figno='01.04';
if freq=10 and TYPEAE ='Severity' then figno='01.05';
if freq=10 and TYPEAE ='Frequency' then figno='01.06';
if freq=11 and TYPEAE ='Severity' then figno='01.07';
if freq=11 and TYPEAE ='Frequency' then figno='01.08';
if freq=16 and TYPEAE ='Frequency' then figno='01.09';
if freq=17 and TYPEAE ='Severity' then figno='01.10';
if freq=17 and TYPEAE ='Frequency' then figno='01.11';
if freq=17 and TYPEAE ='Interference' then figno='01.12';
if freq=23 and TYPEAE ='Presence/Absence' then figno='01.13';

if vislbl='Baseline' then visit=-0.5;
if vislbl='Cycle 2' then visit=1;
if vislbl='Cycle 3' then visit=2;
if vislbl='Cycle 4' then visit=3;
if vislbl='Cycle 5' then visit=4;
if vislbl='Cycle 6' then visit=5;
if vislbl='Cycle 7' then visit=6;
if vislbl='Cycle 8' then visit=7;
if vislbl='Cycle 9' then visit=8;
if vislbl='Cycle 10' then visit=9;
if vislbl='Cycle 11' then visit=10;
if vislbl='Cycle 12' then visit=11;
if vislbl='Cycle 13' then visit=12;
if vislbl='Cycle 14' then visit=13;
if vislbl='Cycle 15' then visit=14;
if vislbl='Cycle 16' then visit=15;

if AVALC='NONE' then aval_cal=0;
if AVALC='NEVER' then aval_cal=0;
if AVALC='NOT AT ALL' then aval_cal=0;
if AVALC='MILD' then aval_cal=1;
if AVALC='MODERTATE' then aval_cal=2;
if AVALC='SEVERE' then aval_cal=3;
if AVALC='VERY SEVERE' then aval_cal=4;
if AVALC='QUITE A BIT' then aval_cal=5;
if AVALC='A LITTLE BIT' then aval_cal=6;
if AVALC='SOMEWHAT' then aval_cal=7;
if AVALC='RARELY' then aval_cal=8;
if AVALC='OCCASIONALLY' then aval_cal=9;
if AVALC='FREQUENTLY' then aval_cal=10;
if AVALC='ALMOST CONSTANTLY' then aval_cal=11;
if AVALC='VERY MUCH' then aval_cal=12;
run;



data ADQS4_1;
set ADQS4_01;
where figno='01.01';
run;

proc sort data=ADQS4_1;by visit freq trtpn;run;
data ADQS4_1;
 set ADQS4_1;
 by visit freq trtpn;
 left=first.trtpn ;
run;

proc sql;
create table ADQS4_2 as
select visit,left,freq,TRTPN,aval_cal,
count(*)/(select count(*) from ADQS4_1 where  visit=a.visit) as pct
 from ADQS4_1  as a
  group by visit,left,freq,trtpn,aval_cal;
quit;
/*calculating count and percent for the total findings by visit and percentage for no vomitings*/
proc sql;
create table ADQS4_trtN as
select  visit,left,freq,TRTPN,count(*) as n,aval_cal
from ADQS4_1  as a
 group by visit,trtpn;

create table ADQS4_trt1N as
select distinct visit,trtpn,n from ADQS4_trtN;

quit;

proc sort data=ADQS4_trt1N;
by visit;
run;

proc transpose data=ADQS4_trt1N out=ADQS4_trt1N_t(drop=_name_ rename=(_1=n1 _2=n2));
   by visit;
   var TRTPN n;
   id TRTPN;
run;

data ADQS4_count;
set ADQS4_trt1N_t;
if _LABEL_ ='Planned Treatment (N)' then delete;
drop _LABEL_;
run;

proc sql;
create table ADQS4_trtNP as
select  visit,left,freq,TRTPN,count(*) as np,aval_cal
from ADQS4_1  as a
group by visit,trtpn,aval_c
having aval_cal=0;

create table ADQS4_trtNP1 as
select distinct visit,trtpn,np from ADQS4_trtNP;
quit;

proc sort data=ADQS4_trtNP1;
by visit;
run;

proc transpose data=ADQS4_trtNP1 out=ADQS4_trtNP1_t(drop=_name_ rename=(_1=pn1 _2=pn2));
   by visit;
   var TRTPN np;
   id TRTPN;
run;

/*counting the percentage of not at all category per visit*/

data ADQS4_count_per;
set ADQS4_trtNP1_t;
if _LABEL_ ='Planned Treatment (N)' then delete;
drop _LABEL_;
rename visit=visit1;
run;

/*joining the count and percent*/
proc sql;
create table cnt_pct as
select a.pn1,a.pn2,b.* from ADQS4_count_per as a join ADQS4_count as b on
a.visit1=b.visit;
quit;

***************************************************************************;


proc sort data=ADQS4_2 out=ADQS4_2_nsort;
by visit trtpn;
run;

data ADQS4_3;
 set /*ADQS4_2*/ ADQS4_2_nsort;
 by visit trtpn;
 if first.trtpn then cum=0;
 cum+pct;
 run;
data ADQS4_4;
 set ADQS4_3;
 if trtpn then cum=-cum;
run;
proc sort data=ADQS4_4;
by visit trtpn aval_cal;
run;
data ADQS4_5;
 set ADQS4_4;
 by visit trtpn aval_cal;
 lag_cum=lag(cum);
 if first.trtpn then lag_cum=0;
 drop pct;
run;
data  ADQS4_6;
 set ADQS4_5;
 if trtpn=1 then do;high=lag_cum;low=cum;end;
 else do;high=cum;low=lag_cum;end;
 if trtpn=2 then do; high=cum; low=lag_cum;end;
 else do;high=lag_cum;low=cum;end;
 drop cum lag_cum;
run;

/*merging the count and main dataset*/
proc sort data=ADQS4_6 out=ADQS4_6_s;
by visit;
run;
proc sort data=cnt_pct out=cnt_pct_s;
by visit;
run;

data pre_final;
merge ADQS4_6_s cnt_pct_s;
by visit;
run;

data final_g_(drop=pn1 pn2 n1_ n2_);
 set /*ADQS4_6*/ pre_final(rename=(n1=n1_ n2=n2_));
 by visit;
if first.visit then do;
n_one=-1.1;
n_zero=-0.1;
p_zero=0.1;
p_one=1.1;
p1_p=-0.9; 
p2_p=0.9; 
zero=0;
n1=n1_;
n2=n2_;
p1=cat(put((pn1/n1)*100,8.),'%');
p2=cat(put((pn2/n1)*100,8.),'%');
select(visit);
when(-0.5) text='Baseline';
when(1)  text='Cycle 2';
when(2)  text='Cycle 3';
when(3)  text='Cycle 4';
when(4)  text='Cycle 5';
when(5)  text='Cycle 6';
when(6)  text='Cycle 7';
when(7)  text='Cycle 8';
when(8)  text='Cycle 9';
when(9)  text='Cycle 10';
when(10) text='Cycle 11';
when(11) text='Cycle 12';
when(12) text='Cycle 13';
when(13) text='Cycle 14';
otherwise;
end;
end;

/*figno=&amp;amp;figno.;*/
if high&amp;lt;=0 then do;high=high-0.1;low=low-0.1;end;
if low&amp;gt;=0 then do;high=high+0.1;low=low+0.1;end;
run;

/*proc sort data=final_g_;*/
/*by visit;*/
/*run;*/




proc format;
value fmt_freq
2='Rarely'
4='Occasion'
8='Frequent'
10='Almost Constantly'
11='Almost 1'
16='Almost 2'
17='Almost 3'
23='Almost 4'

;
run;
proc format;
value fmt_fre
.='Missing'
0='None'
1='Mild'
2='Moderate'
3='Severe'
4='Rarely'
5='Occassion'
;
run;

data final_g;
set final_g_;
format  aval_cal fmt_fre. low high fmt. ;
figno='01.01';
run;

/*generaing graph*/

options leftmargin = 1.5cm rightmargin = 1.5cm topmargin = 1.5cm bottommargin = 2.0cm
        formchar = '|----|+|---+=|-/&amp;lt;&amp;gt;*' nonumber nodate nocenter nomprint
        orientation=landscape papersize=A4 dev=PNG300;
/*goptions XPIXELS=0 YPIXELS=0;*/
ods graphics on / reset = all width = 25.6cm height = 15.4cm  noborder; 

ods pdf file = "&amp;amp;outpath\BI9009A_F01_PRO_CTCAE_Stacked_BAR_Chart_v1_0.pdf"
 	pdftoc=1 compress=9 uniform nopdfnote nogtitle nogfootnote dpi=300 ;

proc sgplot data=final_g noborder;
Where figNo = "01.01";
title  'Xenutuzumab with E+E                                    Placebo with E+E ';
styleattrs datacolors=( yellow orange navy verylightblue green pink) ;
highlow y=visit low=n_one high=n_zero/type=bar fillattrs=(color=verydarkgreen)
nooutline transparency=0.8 name='n' legendlabel='Never';
highlow y=visit low=p_zero high=p_one/type=bar fillattrs=(color=verydarkgreen)
nooutline transparency=0.8;

highlow y=visit low=low high=high/type=bar group=aval_cal nooutline name='a';


scatter y=visit x=p1_p/markerchar=p1 markercharattrs=(size=8) x2axis;
scatter y=visit x=p2_p/markerchar=p2 markercharattrs=(size=8) x2axis;

text y=visit x=zero text=text/strip contributeoffsets=none splitchar=' ' splitpolicy=splitalways textattrs=(size=8);

yaxistable n1/y=visit location=outside position=left valueattrs=(size=8 ) VALUEJUSTIFY=right VALUEHALIGN=right ;
yaxistable n2/y=visit location=outside position=right valueattrs=(size=8) VALUEJUSTIFY=left VALUEHALIGN=left;

xaxis values=(-1.1 to 1.1 by 0.2) display=(nolabel noline) valuesdisplay=(
'100%' '80%' '60%' '40%' '20%' '0%'  '0%' '20%' '40%' '60%' '80%' '100%') offsetmin=0 offsetmax=0 ;
x2axis values=(-1 -0.7 0 0.7 1) display=(nolabel noline noticks) valuesdisplay=(
' '  'Patients Without Symp(%)' ' '  'Patients Without Symp(%)'  ' ') offsetmin=0 offsetmax=0 ;

yaxis reverse display=none ;
keylegend 'n' 'a' /title='Frequency:';

ods pdf close;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;thanks for your time and help.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2022 10:21:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/833297#M329405</guid>
      <dc:creator>Ravindra_</dc:creator>
      <dc:date>2022-09-14T10:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to get split graph with labels on the bars</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/833298#M329406</link>
      <description>Its the similar graph that we have got same butterfly plot, but with two treatment groups</description>
      <pubDate>Wed, 14 Sep 2022 10:22:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/833298#M329406</guid>
      <dc:creator>Ravindra_</dc:creator>
      <dc:date>2022-09-14T10:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to get split graph with labels on the bars</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/833316#M329413</link>
      <description>I don't understand that isn't the left side (negative value) is one treatment, and right side(positive value) is another treatment ?&lt;BR /&gt;</description>
      <pubDate>Wed, 14 Sep 2022 11:58:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/833316#M329413</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-09-14T11:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to get split graph with labels on the bars</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/833318#M329414</link>
      <description>BTW, Can you post dataset "ANA.ADQS4" ? so I can test your code.</description>
      <pubDate>Wed, 14 Sep 2022 12:00:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-split-graph-with-labels-on-the-bars/m-p/833318#M329414</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-09-14T12:00:30Z</dc:date>
    </item>
  </channel>
</rss>

