<?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 data labels for all bars if i select grouping style is stack in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/How-to-get-data-labels-for-all-bars-if-i-select-grouping-style/m-p/340875#M6621</link>
    <description>&lt;P&gt;Recent releases of&amp;nbsp;PROC SGPLOT&amp;nbsp;support the SEGLABEL option on the VBAR statement.&amp;nbsp; By default, labels are "thinned" if a bar is extremely small, but you can use SEGLABELFITPOLIFY=NONE to force labels for all bars:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=sashelp.cars;
vbar type / group=origin groupdisplay=stack
            seglabel seglabelfitpolicy=none;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 14 Mar 2017 17:36:09 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2017-03-14T17:36:09Z</dc:date>
    <item>
      <title>How to get data labels for all bars if i select grouping style is stack</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/How-to-get-data-labels-for-all-bars-if-i-select-grouping-style/m-p/340760#M6612</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;How to get data labels for all bars if i select grouping style is stack.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Srinivas&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 13:06:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/How-to-get-data-labels-for-all-bars-if-i-select-grouping-style/m-p/340760#M6612</guid>
      <dc:creator>srinivaschary</dc:creator>
      <dc:date>2017-03-14T13:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to get data labels for all bars if i select grouping style is stack</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/How-to-get-data-labels-for-all-bars-if-i-select-grouping-style/m-p/340814#M6616</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;SAS: Stacked Vertical Bar chart(histogram) with bar segmants labeled

for sqgplot see
https://dl.dropboxusercontent.com/u/15716238/pie_1511nov_bargrf.pdf

inspired by
https://goo.gl/vvLpFH
https://communities.sas.com/t5/SAS-Visual-Analytics/How-to-get-data-labels-for-all-bars-if-i-select-grouping-style/m-p/340760


HAVE DATA and Format
====================

Up to 40 obs from bargrf total obs=9

Obs    substatus    frequency    statusdes                   des

 1     BBB01          6.0005     &amp;nbsp;&amp;nbsp;New Students        PreK 3(1.8%)
 2     BBB11         37.0010     &amp;nbsp;&amp;nbsp;New Students        1st 37(22.3%)
 3     BBB21         11.0015     &amp;nbsp;&amp;nbsp;New Students        2nd 11(6.6%)
 4     BBB31         13.0020     &amp;nbsp;&amp;nbsp;New Students        3rd 13(7.8%)
 5     BBB41         13.0025     &amp;nbsp;&amp;nbsp;New Students        4th 13(7.8%)
 6     EEE16_40       4.0035     &amp;nbsp;&amp;nbsp;&amp;nbsp;OutOfDistrict      1st-8th 1(0.6%)
 7     EEE1_15       12.0040     &amp;nbsp;&amp;nbsp;&amp;nbsp;OutOfDistrict      2nd-8th 12(7.2%)
 8     ALLCHA        33.0030     &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Local Students    All 33(19.9%)
 9     ALLNA         43.0045     &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;N/A              All 43(25.9%)


Thi sis the cntlin for proc formats

Up to 40 obs from barfmt total obs=9

Obs    fmtname    fuzz     start       end           label

 1     lbl2pnt      0      6.0005     6.0005    PreK 3(1.8%)
 2     lbl2pnt      0     37.0010    37.0010    1st 37(22.3%)
 3     lbl2pnt      0     11.0015    11.0015    2nd 11(6.6%)
 4     lbl2pnt      0     13.0020    13.0020    3rd 13(7.8%)
 5     lbl2pnt      0     13.0025    13.0025    4th 13(7.8%)
 6     lbl2pnt      0      4.0035     4.0035    1st-8th 1(0.6%)
 7     lbl2pnt      0     12.0040    12.0040    2nd-8th 12(7.2%)
 8     lbl2pnt      0     33.0030    33.0030    All 33(19.9%)
 9     lbl2pnt      0     43.0045    43.0045    All 43(25.9%)


WANT (example not the data)

frequency Sum

   |       BBBBBBB
   |       B     B
   |       B 28  B
20 +       B     B
   |       B     B       BBBBBBB
   |       BBBBBBB       B     B
   |       AAAAAAA       B 15  B
   |       A     A       B     B
10 +       A     A       B     B
   |       A 13  A       BBBBBBB
   |       A     A       AAAAAAA
   |       A     A       A 5   A
   |       AAAAAAA       AAAAAAA
   --------------------------------

       New Students  Out of District

Symbol substatus     Symbol substatus

   A   1st Grade           B  1nd Grade

WORKING CODE
============

proc sgplot data=bargrf noautolegend ;
vbar statusdes/group=substatus  response=frequency seglabel
      seglabelattrs=(family="Arial" size=12pt)  seglabelformat=lbl2pnt.;

FULL SOLUTION
=============

* macro on end;
proc datasets lib=work kill;
run;quit;

%let outpdf01=d:/pdf/bargrf.pdf;

%utlopts;
options orientation=landscape validvarname=v7;
%utl_pielan100(
     topmargin=.5in
    ,TitleFont=22pt
    ,docfont=20pt
    ,fixedfont=18pt
    ,rules=all
    ,frame=box
);

ods listing close;
ods pdf close;
ods path work.templat(update) sasuser.templat(update) sashelp.tmplmst(read);
%utlfkil(&amp;amp;outpdf01.);
ods noptitle;
ods escapechar='^';
ods listing close;
ods graphics on / width=10in  height=7in ;
ods pdf file="&amp;amp;outpdf01." style=utl_pielan100 notoc;

proc sql;
create table bargrf(substatus varchar(10), frequency float,
  statusdes varchar(18), des varchar(24));
Insert into bargrf(substatus, frequency, statusdes, des)
Values('BBB01', 6.0005, '&amp;nbsp;&amp;nbsp;New Students', 'PreK 3(1.8%)');
Insert into bargrf(substatus, frequency, statusdes, des)
Values('BBB11', 37.001, '&amp;nbsp;&amp;nbsp;New Students', '1st 37(22.3%)');
Insert into bargrf(substatus, frequency, statusdes, des)
Values('BBB21', 11.0015, '&amp;nbsp;&amp;nbsp;New Students', '2nd 11(6.6%)');
Insert into bargrf(substatus, frequency, statusdes, des)
Values('BBB31', 13.002, '&amp;nbsp;&amp;nbsp;New Students', '3rd 13(7.8%)');
Insert into bargrf(substatus, frequency, statusdes, des)
Values('BBB41', 13.0025, '&amp;nbsp;&amp;nbsp;New Students', '4th 13(7.8%)');
Insert into bargrf(substatus, frequency, statusdes, des)
Values('EEE16_40', 4.0035, '&amp;nbsp;&amp;nbsp;&amp;nbsp;OutOfDistrict', '1st-8th 1(0.6%)');
Insert into bargrf(substatus, frequency, statusdes, des)
Values('EEE1_15', 12.004, '&amp;nbsp;&amp;nbsp;&amp;nbsp;OutOfDistrict', '2nd-8th 12(7.2%)');
Insert into bargrf(substatus, frequency, statusdes, des)
Values('ALLCHA', 33.003, '&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Local Students', 'All 33(19.9%)');
Insert into bargrf(substatus, frequency, statusdes, des)
Values('ALLNA', 43.0045, '&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;N/A', 'All 43(25.9%)');
quit;

data barfmt;
 retain fmtname "lbl2pnt" fuzz 1e-10;
 set bargrf;
 start=frequency;
 end=start;
 label=des;
 keep fmtname fuzz start end label;
;run;quit;

proc format cntlin=barfmt;
run;quit;

* output the graph;
proc sgplot data=bargrf noautolegend ;
title "Minority Percentages for Local Schoold(fake data)";
vbar statusdes/group=substatus  response=frequency seglabel
      seglabelattrs=(family="Arial" size=12pt)  seglabelformat=lbl2pnt.;
yaxis labelattrs=(size=15pt) valueattrs=(size=13pt)
      label="Number of Students"  DISCRETEORDER=Data;;
xaxis labelattrs=(size=12pt) valueattrs=(size=12pt) display=(nolabel) ;
run;

ods graphics off;
ods pdf close;
ods listing;


%Macro utl_pielan100
    (
      style=utl_pielan100
      ,frame=box
      ,TitleFont=13pt
      ,docfont=13pt
      ,fixedfont=12pt
      ,rules=ALL
      ,bottommargin=.25in
      ,topmargin=.25in
      ,rightmargin=.25in
      ,leftmargin=.25in
      ,cellheight=13pt
      ,cellpadding = 2pt
      ,cellspacing = .2pt
      ,borderwidth = .2pt
    ) /  Des="SAS PDF Template for PDF";

ods path work.templat(update) sasuser.templat(update) sashelp.tmplmst(read);

Proc Template;

   define style &amp;amp;Style;
   parent=styles.rtf;

        replace body from Document /

               protectspecialchars=off
               asis=on
               bottommargin=&amp;amp;bottommargin
               topmargin   =&amp;amp;topmargin
               rightmargin =&amp;amp;rightmargin
               leftmargin  =&amp;amp;leftmargin
               ;

        replace color_list /
              'link' = blue
               'bgH'  = _undef_
               'fg'  = black
               'bg'   = _undef_;

        replace fonts /
               'TitleFont2'           = ("Arial, Helvetica, Helv",&amp;amp;titlefont,Bold)
               'TitleFont'            = ("Arial, Helvetica, Helv",&amp;amp;titlefont,Bold)

               'HeadingFont'          = ("Arial, Helvetica, Helv",&amp;amp;titlefont)
               'HeadingEmphasisFont'  = ("Arial, Helvetica, Helv",&amp;amp;titlefont,Italic)

               'StrongFont'           = ("Arial, Helvetica, Helv",&amp;amp;titlefont,Bold)
               'EmphasisFont'         = ("Arial, Helvetica, Helv",&amp;amp;titlefont,Italic)

               'FixedFont'            = ("Courier New, Courier",&amp;amp;fixedfont)
               'FixedEmphasisFont'    = ("Courier New, Courier",&amp;amp;fixedfont,Italic)
               'FixedStrongFont'      = ("Courier New, Courier",&amp;amp;fixedfont,Bold)
               'FixedHeadingFont'     = ("Courier New, Courier",&amp;amp;fixedfont,Bold)
               'BatchFixedFont'       = ("Courier New, Courier",&amp;amp;fixedfont)

               'docFont'              = ("Arial, Helvetica, Helv",&amp;amp;docfont)

               'FootFont'             = ("Arial, Helvetica, Helv", 9pt)
               'StrongFootFont'       = ("Arial, Helvetica, Helv",8pt,Bold)
               'EmphasisFootFont'     = ("Arial, Helvetica, Helv",8pt,Italic)
               'FixedFootFont'        = ("Courier New, Courier",8pt)
               'FixedEmphasisFootFont'= ("Courier New, Courier",8pt,Italic)
               'FixedStrongFootFont'  = ("Courier New, Courier",7pt,Bold);

        replace GraphFonts /
               'GraphDataFont'        = ("Arial, Helvetica, Helv",&amp;amp;fixedfont)
               'GraphValueFont'       = ("Arial, Helvetica, Helv",&amp;amp;fixedfont)
               'GraphLabelFont'       = ("Arial, Helvetica, Helv",&amp;amp;fixedfont,Bold)
               'GraphFootnoteFont'    = ("Arial, Helvetica, Helv",8pt)
               'GraphTitleFont'       = ("Arial, Helvetica, Helv",&amp;amp;titlefont,Bold)
               'GraphAnnoFont'        = ("Arial, Helvetica, Helv",&amp;amp;fixedfont)
               'GraphUnicodeFont'     = ("Arial, Helvetica, Helv",&amp;amp;fixedfont)
               'GraphLabel2Font'      = ("Arial, Helvetica, Helv",&amp;amp;fixedfont)
               'GraphTitle1Font'      = ("Arial, Helvetica, Helv",&amp;amp;fixedfont);

        style Graph from Output/
                outputwidth = 100% ;

        style table from table /

                protectspecialchars=on
                asis=on
                background = colors('tablebg')
                frame=&amp;amp;frame
                rules=&amp;amp;rules
                cellheight  = &amp;amp;cellheight
                cellpadding = &amp;amp;cellpadding
                cellspacing = &amp;amp;cellspacing
                bordercolor = colors('tableborder')
                borderwidth = &amp;amp;borderwidth;

         replace Footer from HeadersAndFooters

                / font = fonts('FootFont')  just=left asis=on protectspecialchars=off ;

                replace FooterFixed from Footer
                / font = fonts('FixedFootFont')  just=left asis=on protectspecialchars=off;

                replace FooterEmpty from Footer
                / font = fonts('FootFont')  just=left asis=on protectspecialchars=off;

                replace FooterEmphasis from Footer
                / font = fonts('EmphasisFootFont')  just=left asis=on protectspecialchars=off;

                replace FooterEmphasisFixed from FooterEmphasis
                / font = fonts('FixedEmphasisFootFont')  just=left asis=on protectspecialchars=off;

                replace FooterStrong from Footer
                / font = fonts('StrongFootFont')  just=left asis=on protectspecialchars=off;

                replace FooterStrongFixed from FooterStrong
                / font = fonts('FixedStrongFootFont')  just=left asis=on protectspecialchars=off;

                replace RowFooter from Footer
                / font = fonts('FootFont')  asis=on protectspecialchars=off just=left;

                replace RowFooterFixed from RowFooter
                / font = fonts('FixedFootFont')  just=left asis=on protectspecialchars=off;

                replace RowFooterEmpty from RowFooter
                / font = fonts('FootFont')  just=left asis=on protectspecialchars=off;

                replace RowFooterEmphasis from RowFooter
                / font = fonts('EmphasisFootFont')  just=left asis=on protectspecialchars=off;

                replace RowFooterEmphasisFixed from RowFooterEmphasis
                / font = fonts('FixedEmphasisFootFont')  just=left asis=on protectspecialchars=off;

                replace RowFooterStrong from RowFooter
                / font = fonts('StrongFootFont')  just=left asis=on protectspecialchars=off;

                replace RowFooterStrongFixed from RowFooterStrong
                / font = fonts('FixedStrongFootFont')  just=left asis=on protectspecialchars=off;

                replace SystemFooter from TitlesAndFooters / asis=on
                        protectspecialchars=off just=left;
    end;
run;
quit;

%Mend utl_pielan100;

Example histogram

proc sql;
create table bargrf(substatus varchar(10), frequency float,
  statusdes varchar(18), des varchar(24));
Insert into bargrf(substatus, frequency, statusdes, des)
Values('BB1', 13.002, 'New Students', '3rd 13(7.8%)');
Insert into bargrf(substatus, frequency, statusdes, des)
Values('BB2', 13.0025, 'New Students', '4th 13(7.8%)');
Insert into bargrf(substatus, frequency, statusdes, des)
Values('BB1', 4.0035, 'OutOfDistrict', '1st-8th 1(0.6%)');
Insert into bargrf(substatus, frequency, statusdes, des)
Values('BB2', 12.004, 'OutOfDistrict', '2nd-8th 12(7.2%)');
quit;

proc chart data=bargrf ;
  vbar statusdes/ sumvar=frequency subgroup=substatus;
run;quit;


&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Mar 2017 15:06:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/How-to-get-data-labels-for-all-bars-if-i-select-grouping-style/m-p/340814#M6616</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2017-03-14T15:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to get data labels for all bars if i select grouping style is stack</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/How-to-get-data-labels-for-all-bars-if-i-select-grouping-style/m-p/340875#M6621</link>
      <description>&lt;P&gt;Recent releases of&amp;nbsp;PROC SGPLOT&amp;nbsp;support the SEGLABEL option on the VBAR statement.&amp;nbsp; By default, labels are "thinned" if a bar is extremely small, but you can use SEGLABELFITPOLIFY=NONE to force labels for all bars:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=sashelp.cars;
vbar type / group=origin groupdisplay=stack
            seglabel seglabelfitpolicy=none;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Mar 2017 17:36:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/How-to-get-data-labels-for-all-bars-if-i-select-grouping-style/m-p/340875#M6621</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-03-14T17:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to get data labels for all bars if i select grouping style is stack</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/How-to-get-data-labels-for-all-bars-if-i-select-grouping-style/m-p/340960#M6625</link>
      <description>&lt;P&gt;If you don't have a new enough version of SAS to use SEGLABEL, there are several options - annotate, GTL, High-Low plots, etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I cover some in my paper Labelling Without the Hassle:&amp;nbsp;&lt;A href="http://www.mwsug.org/proceedings/2014/DV/MWSUG-2014-DV04.pdf" target="_blank"&gt;http://www.mwsug.org/proceedings/2014/DV/MWSUG-2014-DV04.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 21:00:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/How-to-get-data-labels-for-all-bars-if-i-select-grouping-style/m-p/340960#M6625</guid>
      <dc:creator>snoopy369</dc:creator>
      <dc:date>2017-03-14T21:00:24Z</dc:date>
    </item>
  </channel>
</rss>

