<?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: Position of seglabel in sgplot in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Position-of-seglabel-in-sgplot/m-p/496966#M16990</link>
    <description>&lt;P&gt;Maybe need change data for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data test;
input patid $ ptstat;
datalines;
1 1
2 1
3 1
4 2
5 2
6 3
7 3
8 3
9 3
10 3
11 3
12 4
13 4
14 4
15 4
16 4
17 4
18 4
19 4
20 4
;
run;
proc freq data=test noprint;
table ptstat/ out=have ;
run;
data have;
 set have;
 _count=count-0.5;
run;

proc format;
value ptstatf 1='Active' 2='LTF/AC/WD' 3='Deceased with Autopsy' 4='Deceased without Autopsy';
quit;
 
title "Cohort Status (N=20)";
proc sgplot data=have noborder;
  vbarparm category=ptstat  response=count /fillattrs=(color=bib) barwidth=0.65 dataskin=matte ;
  text x=ptstat y=_count text=count/ strip TEXTATTRS=(size=14  color=white)  ;
  xaxis label='Status' display=(noticks) labelattrs=(size=12 family=arial);
  yaxis label='# Particpants' GRID VALUES = (0 TO 10 BY 2) labelattrs=(size=12 family=arial);
format ptstat ptstatf.;
run;
title;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 19 Sep 2018 13:52:10 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2018-09-19T13:52:10Z</dc:date>
    <item>
      <title>Position of seglabel in sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Position-of-seglabel-in-sgplot/m-p/496920#M16983</link>
      <description>&lt;P&gt;Morning,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm curious if anyone is aware of a seglabel option for positioning the label at the top of the bar? Currently the default appears to place the label in the middle of the bar. I'm using 9.4 M4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Lucas&lt;/P&gt;</description>
      <pubDate>Wed, 19 Sep 2018 12:20:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Position-of-seglabel-in-sgplot/m-p/496920#M16983</guid>
      <dc:creator>lbarwick</dc:creator>
      <dc:date>2018-09-19T12:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: Position of seglabel in sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Position-of-seglabel-in-sgplot/m-p/496921#M16984</link>
      <description>&lt;P&gt;Have you got some code to work from?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Sep 2018 12:21:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Position-of-seglabel-in-sgplot/m-p/496921#M16984</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-09-19T12:21:22Z</dc:date>
    </item>
    <item>
      <title>Re: Position of seglabel in sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Position-of-seglabel-in-sgplot/m-p/496929#M16985</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data test;
input patid $ ptstat;
datalines;
1 1
2 1
3 1
4 2
5 2
6 3
7 3
8 3
9 3
10 3
11 3
12 4
13 4
14 4
15 4
16 4
17 4
18 4
19 4
20 4
;
run;

proc format;
value ptstatf 1='Active' 2='LTF/AC/WD' 3='Deceased with Autopsy' 4='Deceased without Autopsy';
quit;
 
title "Cohort Status (N=20)";
proc sgplot data=test noborder;
  vbar ptstat / fillattrs=(color=bib) barwidth=0.65 seglabel seglabelattrs=(size=12 family=arial color=white)
    stat=sum dataskin=matte;
  xaxis label='Status' display=(noticks) labelattrs=(size=12 family=arial);
  yaxis label='# Particpants' GRID VALUES = (0 TO 10 BY 2) labelattrs=(size=12 family=arial);
format ptstat ptstatf.;
run;
title;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Sep 2018 12:38:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Position-of-seglabel-in-sgplot/m-p/496929#M16985</guid>
      <dc:creator>lbarwick</dc:creator>
      <dc:date>2018-09-19T12:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: Position of seglabel in sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Position-of-seglabel-in-sgplot/m-p/496937#M16987</link>
      <description>&lt;P&gt;Does it have to be done with the seglabel option? If all you want is to place the label on top of the bar, you can use the &lt;A href="https://documentation.sas.com/?docsetId=grstatproc&amp;amp;docsetTarget=n0p7vdd69sgf3wn1479qxqxuryrt.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#p1knsfepcp6q3tn1rcxjyvwtszoxo" target="_self"&gt;Datalabel Option&lt;/A&gt; like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title "Cohort Status (N=20)";
proc sgplot data=test noborder;
  vbar ptstat / fillattrs=(color=bib) barwidth=0.65 datalabel datalabelpos=data datalabelattrs=(size=12 family=arial color=black)
    stat=sum dataskin=matte;
  xaxis label='Status' display=(noticks) labelattrs=(size=12 family=arial);
  yaxis label='# Particpants' GRID VALUES = (0 TO 10 BY 2) labelattrs=(size=12 family=arial);
format ptstat ptstatf.;
run;
title;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Sep 2018 12:49:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Position-of-seglabel-in-sgplot/m-p/496937#M16987</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-09-19T12:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: Position of seglabel in sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Position-of-seglabel-in-sgplot/m-p/496943#M16988</link>
      <description>&lt;P&gt;I want the label at the top of the bar, inside the bar - not on top of bar. Does datalabel have this option?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Sep 2018 12:56:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Position-of-seglabel-in-sgplot/m-p/496943#M16988</guid>
      <dc:creator>lbarwick</dc:creator>
      <dc:date>2018-09-19T12:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: Position of seglabel in sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Position-of-seglabel-in-sgplot/m-p/496964#M16989</link>
      <description>&lt;P&gt;No I dont think so. You can do a workaround doing something like this. Use &lt;A href="https://documentation.sas.com/?docsetId=grstatproc&amp;amp;docsetTarget=n0mc5dtithid5mn13c54dlgaceq3.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#p1etmfroq8mx8kn1ao7pjy3p5x2of" target="_self"&gt;VBARPARM&lt;/A&gt; instead of VBAR and use &lt;A href="https://documentation.sas.com/?docsetId=grstatproc&amp;amp;docsetTarget=n0lprj1bdrlrkgn1vmqnd7r6fnry.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;TEXT Statement&lt;/A&gt; to inset the labels. A bit overkill perhaps though...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input patid $ ptstat;
datalines;
1 1
2 1
3 1
4 2
5 2
6 3
7 3
8 3
9 3
10 3
11 3
12 4
13 4
14 4
15 4
16 4
17 4
18 4
19 4
20 4
;
run;

proc format;
value ptstatf 1='Active' 2='LTF/AC/WD' 3='Deceased with Autopsy' 4='Deceased without Autopsy';
quit;

proc sql;
   create table stats as
   select ptstat format=ptstatf.
         ,count(patid) as NumParticpants
         ,count(patid)-.5 as Position
   from test
   group by ptstat;
quit;
 
title "Cohort Status (N=20)";
proc sgplot data=stats noborder noautolegend;
  vbarparm category=ptstat response=NumParticpants / fillattrs=(color=bib) barwidth=0.65 dataskin=matte;
  text x=ptstat y=Position text=NumParticpants / position=left textattrs=(size=12 family=arial color=white);
  xaxis label='Status' display=(noticks) labelattrs=(size=12 family=arial);
  yaxis label='# Particpants' GRID VALUES = (0 TO 10 BY 2) labelattrs=(size=12 family=arial) offsetmin=0;
format ptstat ptstatf.;
run;
title;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Sep 2018 13:45:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Position-of-seglabel-in-sgplot/m-p/496964#M16989</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-09-19T13:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: Position of seglabel in sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Position-of-seglabel-in-sgplot/m-p/496966#M16990</link>
      <description>&lt;P&gt;Maybe need change data for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data test;
input patid $ ptstat;
datalines;
1 1
2 1
3 1
4 2
5 2
6 3
7 3
8 3
9 3
10 3
11 3
12 4
13 4
14 4
15 4
16 4
17 4
18 4
19 4
20 4
;
run;
proc freq data=test noprint;
table ptstat/ out=have ;
run;
data have;
 set have;
 _count=count-0.5;
run;

proc format;
value ptstatf 1='Active' 2='LTF/AC/WD' 3='Deceased with Autopsy' 4='Deceased without Autopsy';
quit;
 
title "Cohort Status (N=20)";
proc sgplot data=have noborder;
  vbarparm category=ptstat  response=count /fillattrs=(color=bib) barwidth=0.65 dataskin=matte ;
  text x=ptstat y=_count text=count/ strip TEXTATTRS=(size=14  color=white)  ;
  xaxis label='Status' display=(noticks) labelattrs=(size=12 family=arial);
  yaxis label='# Particpants' GRID VALUES = (0 TO 10 BY 2) labelattrs=(size=12 family=arial);
format ptstat ptstatf.;
run;
title;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Sep 2018 13:52:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Position-of-seglabel-in-sgplot/m-p/496966#M16990</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-09-19T13:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: Position of seglabel in sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Position-of-seglabel-in-sgplot/m-p/496967#M16991</link>
      <description>&lt;P&gt;Thanks. Ksharp's method works but I do agree this is overkill. Seems like SAS should just implement an option within seglabel for this to make it a bit easier...&lt;/P&gt;</description>
      <pubDate>Wed, 19 Sep 2018 13:55:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Position-of-seglabel-in-sgplot/m-p/496967#M16991</guid>
      <dc:creator>lbarwick</dc:creator>
      <dc:date>2018-09-19T13:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: Position of seglabel in sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Position-of-seglabel-in-sgplot/m-p/496969#M16992</link>
      <description>&lt;P&gt;Yes, this is on our list of features, including an option to add a back light&amp;nbsp;for easier visibility.&amp;nbsp; It did not make it into the release due to schedule and priorities.&amp;nbsp; While overlaying TextPlot is an option (includes back light), it required users to compute the position of each segment.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Separately, (just FYI) there is a BarLabelFitPolity=InsidePreferred for non grouped horizontal bars that will place a data label inside the bar at the top.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Sep 2018 14:05:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Position-of-seglabel-in-sgplot/m-p/496969#M16992</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2018-09-19T14:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: Position of seglabel in sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Position-of-seglabel-in-sgplot/m-p/496975#M16993</link>
      <description>Good to know!!</description>
      <pubDate>Wed, 19 Sep 2018 14:14:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Position-of-seglabel-in-sgplot/m-p/496975#M16993</guid>
      <dc:creator>lbarwick</dc:creator>
      <dc:date>2018-09-19T14:14:49Z</dc:date>
    </item>
  </channel>
</rss>

