<?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: SGPLOT: Displaying absolute and relative values on a bar chart in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861722#M340374</link>
    <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Anita_n_0-1677673400954.png" style="width: 774px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/80990iBFEA76FFFB5EF36B/image-dimensions/774x120?v=v2" width="774" height="120" role="button" title="Anita_n_0-1677673400954.png" alt="Anita_n_0-1677673400954.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 01 Mar 2023 12:23:57 GMT</pubDate>
    <dc:creator>Anita_n</dc:creator>
    <dc:date>2023-03-01T12:23:57Z</dc:date>
    <item>
      <title>SGPLOT: Displaying absolute and relative values on a bar chart</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861385#M340261</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;
&lt;P&gt;assuming I have a a bar chart plotted using sgplot and I wish to add behind the absolute values the relative values in bracket. Is this possible? If yes please any help. I created a label with both values and assigned this as follows seglabel=mylabel but this doesnt work&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Anita_n_0-1677593734344.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/80931i9F2599414D213D34/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Anita_n_0-1677593734344.png" alt="Anita_n_0-1677593734344.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 14:15:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861385#M340261</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2023-02-28T14:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT: Displaying absolute and relative values on a bar chart</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861394#M340264</link>
      <description>&lt;P&gt;"&lt;SPAN&gt;absolute values the relative values in bracket.&lt;/SPAN&gt;" - relative to what? Do you want to have something like: "10 (30%)" ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 14:30:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861394#M340264</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-02-28T14:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT: Displaying absolute and relative values on a bar chart</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861396#M340266</link>
      <description>&lt;P&gt;Yes,&amp;nbsp; that is what I mean. The percentages in bracket&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 14:32:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861396#M340266</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2023-02-28T14:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT: Displaying absolute and relative values on a bar chart</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861446#M340292</link>
      <description>&lt;P&gt;something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input year val group $;
cards;
2012 2 g
2012 6 r
2012 1 b
2013 7 r
2013 1 b
2014 2 g
2015 3 r
2016 1 g
2016 4 r
2017 2 g
2017 5 r
2017 1 b
;
run;

data have2;

  total = 0;
  do _N_ = 1 by 1 until(last.year);
    set have;
    by year;
    total + val;     
  end;

  tot = 0;
  do _N_ = 1 to _N_;
    set have;
    pos = tot + 0.5*val;
    tot + val;
    length vallabel $ 20;
    vallabel = cats(val,"(", put(val/total, percent10.2 ),")");
    output;
  end;

run;

proc print;
run;

proc sgplot data = have2;
  STYLEATTRS DATACOLORS=(lightgreen lightred lightblue);

  VBARPARM  category=year response=val / group=group 
   GROUPORDER=DATA 
   GROUPDISPLAY=STACK
  ;
  text x=year y=pos text=vallabel / group=group
   TEXTATTRS=(Color=black Family="Arial" Size=8 Weight=bold)
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;?&lt;/P&gt;
&lt;P&gt;bart&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 15:40:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861446#M340292</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-02-28T15:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT: Displaying absolute and relative values on a bar chart</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861485#M340303</link>
      <description>&lt;P&gt;Thankyou for that, very interesting to know that there is a possibility like this. Am still tring it. Haven't got it right with the positioning (pos). I will let you know if it worked&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 16:17:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861485#M340303</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2023-02-28T16:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT: Displaying absolute and relative values on a bar chart</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861694#M340360</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/35763"&gt;@yabwon&lt;/a&gt;&amp;nbsp;since am still not getting the positioning let me post how my data really looks like maybe you can help&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;                                          
infile datalines;                                   
input period $10.  drug $15.  visit dosis 2.;
datalines; 
2000-2005	Cefalexin       1 12     
2000-2005	Calcipotriol	1 16     
2000-2005	Folic acid	    1 26     
2000-2005	Piriton         1 3      
2000-2005	Fentanyl	    1 36     &lt;BR /&gt;2000-2005	Folic acid      1 26     
2000-2005	Co-beneldopa	1 35     
2000-2005	Folic acid      1 26     
2000-2005	Cefalexin	    1 11     
2000-2005	Fentanyl	    1 35     
2006-2011	Allopurinol     1 33     
2006-2011	Folic acid      1 27     
2006-2011	Cefalexin       1 11     
2006-2011	Allopurinol	    1 33     
2006-2011	Cefalexin       1 11     
2006-2011	Folic acid      1 26     
2006-2011	Piriton	        1 3      
2006-2011	Folic acid	    1 27     
2006-2011	Allopurinol	    1 33     
2006-2011	Piriton	        1 3      
2006-2011	Cefalexin       1 11     
2011-2022	Piriton	        1 3      
2011-2022	Cefalexin	    1 11     
2011-2022	Cefalexin	    1 12     
2011-2022	Cefalexin	    1 11     
2011-2022	Cefalexin	    1 11     
2011-2022	Baclofen	    1 35     
2011-2022	Diclofenac	    1 22     
2011-2022	Diclofenac      1 22     
2011-2022	Co-beneldopa	1 35     
2011-2022	Co-beneldopa	1 3
2011-2022   Other Piriton   1 22 
2000-2005	Co-beneldopa    2 3      
2000-2005	Folic acid      2 15     
2000-2005	Cefalexin		2 14     
2000-2005	Fentanyl	    2 11     
2000-2005	Allopurinol     2 3      
2000-2005	Folic acid      2 3      
2000-2005	Cefalexin       2 5      
2000-2005	Allopurinol	    2 15     
2000-2005	Cefalexin       2 35     
2006-2011	Folic acid  	2 16     
2006-2011	Piriton	        2 22     
2006-2011	Folic acid	    2 38     
2006-2011	Allopurinol	    2 11     
2006-2011	Piriton	        2 7      
2006-2011	Cefalexin       2 11     
2006-2011	Piriton	        2 11     
2006-2011	Cefalexin	    2 15     
2006-2011	Cefalexin	  	2 17     
2006-2011	Cefalexin	    2 11     
2011-2022	Cefalexin	    2 33     
2011-2022	Baclofen	    2 77     
2011-2022	Diclofenac	    2 25     
2011-2022	Acrivastine     2 12     
2011-2022	Acrivastine     2 8     
2011-2022	Acrivastine     2 15     
2011-2022	Acrivastine     2 20     
2011-2022	Acrivastine     2 6     
2011-2022	Acrivastine     2 20     
2011-2022	Acrivastine     2 33
2011-2022   Other Piriton   2 14
2000-2005	Cefalexin       3 14     
2000-2005	Calcipotriol	3 18     
2000-2005	Folic acid	    3 16     
2000-2005	Piriton         3 15     
2000-2005	Fentanyl	    3 19     
2000-2005	Folic acid      3 20     
2000-2005	Co-beneldopa  3 25     
2000-2005	Folic acid    3 52     
2000-2005	Cefalexin	  3 25     
2000-2005	Fentanyl	  3 16     
2006-2011	Allopurinol   3 8       
2006-2011	Folic acid    3 2       
2006-2011	Cefalexin     3 55       
2006-2011	Allopurinol	  3 70       
2006-2011	Cefalexin     3 18       
2006-2011	Folic acid    3 1       
2006-2011	Piriton	      3 20       
2006-2011	Folic acid	  3 11       
2006-2011	Allopurinol	  3 14       
2006-2011	Piriton	      3 7      
2006-2011	Cefalexin     3 33       
2011-2022	Piriton	      3 20       
2011-2022	Cefalexin	  3 15       
2011-2022	Cefalexin	  3 12       
2011-2022	Cefalexin	  3 77       
2011-2022	Cefalexin	  3 6       
2011-2022	Acrivastine	  3 44       
2011-2022	Acrivastine	  3 7       
2011-2022	Acrivastine	  3 25       
2011-2022	Acrivastine	  3 11       
2011-2022	Acrivastine	  3 9   
2011-2022   Other Piriton 3 8
;                                  
run;                               

proc sql;
create table have2 as select period, drug, visit,  sum(dosis) as SumDosis from have group by period, drug, visit;

create table sumtotal as select period,visit, sum(SumDosis) as totals  from have2  group by period, visit;

create table have3 as select a.*, b.totals, SumDosis/totals as percentage format percent8.2 from have2 as 
a, sumtotal as b where a.visit=b.visit and a.period=b.period;

quit;

data have4;
set have3;
length N_percentage $15 ;
N_Percentage=catx(" ", SumDosis, "(", put(percentage, percent8.2), ")");
keep period drug visit SumDosis N_percentage;
run;
proc sort data have4;
by period visit drug;
run;

proc sgpanel data = have4;
styleattrs datacolors=(lightgreen lightred lightblue);
panelby period /columns=3 novarname noborder;
 vbarparm  category=visit response=SumDosis / group=drug grouporder=data  datalabel seglabel groupdisplay=stack;
  *text x=year y=pos text=vallabel / group=group TEXTATTRS=(Color=black Family="Arial" Size=8 Weight=bold)
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;This is how it looks like when I apply your code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have5;
tot = 0;
  do _N_ = 1 to _N_;
    set have4;
    pos = tot + 0.5*SumDosis;
    tot + SumDosis;
      glabel = N_percentage;
    output;
  end;

run;

proc sgpanel data = have5;
styleattrs datacolors=(lightgreen lightred lightblue);
panelby period /columns=3 novarname noborder;
 vbarparm  category=visit response=SumDosis / group=drug grouporder=data  datalabel  groupdisplay=stack;
  text x=visit y=pos text=glabel / group=drug TEXTATTRS=(Color=black Family="Arial" Size=8 Weight=bold)
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 10:29:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861694#M340360</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2023-03-01T10:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT: Displaying absolute and relative values on a bar chart</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861700#M340362</link>
      <description>&lt;P&gt;try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;                                          
infile datalines dlm="|";                                   
input period : $ 10.  drug : $ 15.  visit dosis 2.;
datalines; 
2000-2005|Cefalexin     |1|12
2000-2005|Calcipotriol  |1|16
2000-2005|Folic acid    |1|26
2000-2005|Piriton       |1|3 
2000-2005|Fentanyl      |1|36
2000-2005|Folic acid    |1|26
2000-2005|Co-beneldopa  |1|35
2000-2005|Folic acid    |1|26
2000-2005|Cefalexin     |1|11
2000-2005|Fentanyl      |1|35
2006-2011|Allopurinol   |1|33
2006-2011|Folic acid    |1|27
2006-2011|Cefalexin     |1|11
2006-2011|Allopurinol   |1|33
2006-2011|Cefalexin     |1|11
2006-2011|Folic acid    |1|26
2006-2011|Piriton       |1|3 
2006-2011|Folic acid    |1|27
2006-2011|Allopurinol   |1|33
2006-2011|Piriton       |1|3 
2006-2011|Cefalexin     |1|11
2011-2022|Piriton       |1|3 
2011-2022|Cefalexin     |1|11
2011-2022|Cefalexin     |1|12
2011-2022|Cefalexin     |1|11
2011-2022|Cefalexin     |1|11
2011-2022|Baclofen      |1|35
2011-2022|Diclofenac    |1|22
2011-2022|Diclofenac    |1|22
2011-2022|Co-beneldopa  |1|35
2011-2022|Co-beneldopa  |1|3
2011-2022|Other Piriton |1|22
2000-2005|Co-beneldopa  |2|3 
2000-2005|Folic acid    |2|15
2000-2005|Cefalexin     |2|14
2000-2005|Fentanyl      |2|11
2000-2005|Allopurinol   |2|3 
2000-2005|Folic acid    |2|3 
2000-2005|Cefalexin     |2|5 
2000-2005|Allopurinol   |2|15
2000-2005|Cefalexin     |2|35
2006-2011|Folic acid    |2|16
2006-2011|Piriton       |2|22
2006-2011|Folic acid    |2|38
2006-2011|Allopurinol   |2|11
2006-2011|Piriton       |2|7 
2006-2011|Cefalexin     |2|11
2006-2011|Piriton       |2|11
2006-2011|Cefalexin     |2|15
2006-2011|Cefalexin     |2|17
2006-2011|Cefalexin     |2|11
2011-2022|Cefalexin     |2|33
2011-2022|Baclofen      |2|77
2011-2022|Diclofenac    |2|25
2011-2022|Acrivastine   |2|12
2011-2022|Acrivastine   |2|8 
2011-2022|Acrivastine   |2|15
2011-2022|Acrivastine   |2|20
2011-2022|Acrivastine   |2|6 
2011-2022|Acrivastine   |2|20
2011-2022|Acrivastine   |2|33
2011-2022|Other Piriton |2|14
2000-2005|Cefalexin     |3|14
2000-2005|Calcipotriol  |3|18
2000-2005|Folic acid    |3|16
2000-2005|Piriton       |3|15
2000-2005|Fentanyl      |3|19
2000-2005|Folic acid    |3|20
2000-2005|Co-beneldopa  |3|25
2000-2005|Folic acid    |3|52
2000-2005|Cefalexin     |3|25
2000-2005|Fentanyl      |3|16
2006-2011|Allopurinol   |3|8 
2006-2011|Folic acid    |3|2 
2006-2011|Cefalexin     |3|55
2006-2011|Allopurinol   |3|70
2006-2011|Cefalexin     |3|18
2006-2011|Folic acid    |3|1 
2006-2011|Piriton       |3|20
2006-2011|Folic acid    |3|11
2006-2011|Allopurinol   |3|14
2006-2011|Piriton       |3|7 
2006-2011|Cefalexin     |3|33
2011-2022|Piriton       |3|20
2011-2022|Cefalexin     |3|15
2011-2022|Cefalexin     |3|12
2011-2022|Cefalexin     |3|77
2011-2022|Cefalexin     |3|6 
2011-2022|Acrivastine   |3|44
2011-2022|Acrivastine   |3|7 
2011-2022|Acrivastine   |3|25
2011-2022|Acrivastine   |3|11
2011-2022|Acrivastine   |3|9 
2011-2022|Other Piriton |3|8
;                                  
run;  
                             
proc print;
run;

proc sql;
create table have2 as select period, drug, visit,  sum(dosis) as SumDosis from have group by period, drug, visit;

create table sumtotal as select period,visit, sum(SumDosis) as totals  from have2  group by period, visit;

create table have3 as select a.*, b.totals, SumDosis/totals as percentage format percent8.2 from have2 as 
a, sumtotal as b where a.visit=b.visit and a.period=b.period;

quit;

proc print;
run;


proc sort data=have3;
by period visit drug;
run;

data have4;
set have3;
by period visit;
if first.visit then tot=0;
pos= tot + SumDosis/2;
tot + SumDosis;
length N_percentage $15 ;
N_Percentage=catx(" ", SumDosis, "(", put(percentage, percent8.2), ")");
keep period drug visit SumDosis N_percentage pos;
run;

proc print;
run;


ods graphics / width=1200px height=1000px;
proc sgpanel data = have4;

  styleattrs datacolors=(
CXfc8d59
CXfdbb84
CXfdd49e
CXfee8c8
CXfff7ec
CXffffff
CXfff7fb
CXece7f2
CXd0d1e6
CXa6bddb
CX74a9cf
);
  panelby period / columns=3 novarname noborder;
  vbarparm  category=visit response=SumDosis / group=drug grouporder=data  groupdisplay=stack
  DATASKIN=NONE OUTLINE OUTLINEATTRS=(color=black THICKNESS=1) FILL 
  ;
  text x=visit y=pos text=N_Percentage / group=drug TEXTATTRS=(Color=black Family="Arial" Size=6 Weight=bold);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;should give you:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yabwon_0-1677667617613.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/80988i7649E0869FE8EE5C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="yabwon_0-1677667617613.png" alt="yabwon_0-1677667617613.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 10:47:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861700#M340362</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-03-01T10:47:14Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT: Displaying absolute and relative values on a bar chart</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861708#M340364</link>
      <description>&lt;P&gt;Thankyou very much&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 11:03:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861708#M340364</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2023-03-01T11:03:03Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT: Displaying absolute and relative values on a bar chart</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861710#M340366</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/35763"&gt;@yabwon&lt;/a&gt;&amp;nbsp;why does the datalabel not show anymore? Does it have any thing to do with the TEXT-Statement?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 11:13:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861710#M340366</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2023-03-01T11:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT: Displaying absolute and relative values on a bar chart</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861712#M340368</link>
      <description>&lt;P&gt;I removed:&amp;nbsp;&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt; datalabel seglabel&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;from the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;B.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 11:29:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861712#M340368</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-03-01T11:29:55Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT: Displaying absolute and relative values on a bar chart</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861715#M340370</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/35763"&gt;@yabwon&lt;/a&gt;&amp;nbsp; I added datalabel but it doesn't work&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 12:10:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861715#M340370</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2023-03-01T12:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT: Displaying absolute and relative values on a bar chart</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861719#M340372</link>
      <description>&lt;P&gt;Could you put a print screen here, and also the log from the proc sgplot?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 12:18:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861719#M340372</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-03-01T12:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT: Displaying absolute and relative values on a bar chart</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861722#M340374</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Anita_n_0-1677673400954.png" style="width: 774px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/80990iBFEA76FFFB5EF36B/image-dimensions/774x120?v=v2" width="774" height="120" role="button" title="Anita_n_0-1677673400954.png" alt="Anita_n_0-1677673400954.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 12:23:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861722#M340374</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2023-03-01T12:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT: Displaying absolute and relative values on a bar chart</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861741#M340379</link>
      <description>&lt;P&gt;Screen shot of the _graph_, and _text_ of the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;B.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 14:58:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861741#M340379</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-03-01T14:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT: Displaying absolute and relative values on a bar chart</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861769#M340386</link>
      <description>&lt;P&gt;Here is the code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have4;
set have3;
by period visit;
if first.visit then tot=0;
pos= tot + SumDosis/2;
tot + SumDosis;
length N_percentage $15 ;
N_Percentage=catx(" ", SumDosis, "(", put(percentage, percent8.2), ")");
keep period drug visit SumDosis N_percentage pos;
run;


ods graphics / width=1200px height=1000px;
proc sgpanel data = have4 noautolegend;
styleattrs datacolors=(lightgreen lightred lightblue);
panelby period /columns=3 novarname noborder;
vbarparm  category=visit response=SumDosis / group=drug  grouporder=data datalabel datalabelattrs=(color=black family="Arial" size=8 weight=bold) groupdisplay=stack name='a' ;
text x=visit y=pos text=n_percentage / group=drug TEXTATTRS=(Color=black Family="Arial" Size=8) name='b';
rowaxis values=(0 to 300 by 50);
keylegend 'a'/ position=bottom across=6 title=" ";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The graph:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Anita_n_0-1677687074813.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/80997i1C7709075A257C78/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Anita_n_0-1677687074813.png" alt="Anita_n_0-1677687074813.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;and log:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Anita_n_1-1677687168025.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/80998i23D0697AE18A5FA0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Anita_n_1-1677687168025.png" alt="Anita_n_1-1677687168025.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 16:13:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861769#M340386</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2023-03-01T16:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT: Displaying absolute and relative values on a bar chart</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861774#M340390</link>
      <description>&lt;P&gt;ok, now I don't understand what do you mean by "&lt;SPAN&gt;why does the data label not show anymore?&lt;/SPAN&gt;" - there are data labels ( "XX (YY%)" ) on the plot, what other data label do you expect ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 16:30:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861774#M340390</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-03-01T16:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT: Displaying absolute and relative values on a bar chart</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861776#M340392</link>
      <description>&lt;P&gt;In sgplot there are datalabel and a seglabel statements,&amp;nbsp; the seglabels label the segements, that is what we did.&amp;nbsp; The datalabel labels the totals per bar, like bar 1 will have a total of 226 placed at the top of the bar. That is what I mean&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 16:37:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861776#M340392</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2023-03-01T16:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT: Displaying absolute and relative values on a bar chart</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861784#M340398</link>
      <description>&lt;P&gt;I think this should be it:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have4;
set have3;
by period visit;
if first.visit then tot=0;
pos= tot + SumDosis/2;
tot + SumDosis;

if last.visit then /* this is to avoid ugly warnings in the log */ 
  do;
    total=tot;
    vst=visit;
  end;

length N_percentage $15 ;
N_Percentage=catx(" ", SumDosis, "(", put(percentage, percent8.2), ")");
keep period drug visit SumDosis N_percentage pos total vst;
run;


ods graphics / width=1200px height=1000px;
proc sgpanel data = have4;

  styleattrs datacolors=(
CXfc8d59
CXfdbb84
CXfdd49e
CXfee8c8
CXfff7ec
CXffffff
CXfff7fb
CXece7f2
CXd0d1e6
CXa6bddb
CX74a9cf
);

  panelby period / columns=3 novarname noborder;

  vbarparm category=vst response=total / datalabel=total seglabel
  OUTLINE OUTLINEATTRS=(color=black THICKNESS=1) NOFILL 
  ;
  vbarparm  category=visit response=SumDosis / group=drug grouporder=data  groupdisplay=stack
  DATASKIN=NONE OUTLINE OUTLINEATTRS=(color=black THICKNESS=1) FILL 
  ;
  text x=visit y=pos text=N_Percentage / group=drug TEXTATTRS=(Color=black Family="Arial" Size=6 Weight=bold);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 17:02:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861784#M340398</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-03-01T17:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT: Displaying absolute and relative values on a bar chart</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861899#M340424</link>
      <description>&lt;P&gt;Thanks, it worked&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 06:50:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-Displaying-absolute-and-relative-values-on-a-bar-chart/m-p/861899#M340424</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2023-03-02T06:50:46Z</dc:date>
    </item>
  </channel>
</rss>

