<?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 SEGLABELs for Stacked Column Chart in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/SEGLABELs-for-Stacked-Column-Chart/m-p/506829#M1408</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having trouble implementing SEGLABELS for each segment and total above the bars in a stacked column chart. Could I get some assistance on how to implement this inside my code? The code prints 2 charts as you will see, the latter chart is the main chart in-use once&amp;nbsp;the previous code completes&amp;nbsp;it's final sort. Thank you for your time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* Set the graphics environment */&lt;BR /&gt;goptions reset=all cback=white border htitle=12pt htext=12pt;&lt;/P&gt;&lt;P&gt;/* Calculate totals for Closed_Date and Close_Reason */&lt;BR /&gt;proc means data=work.dailyclosures noprint;&lt;BR /&gt;by Closed_Date;&lt;BR /&gt;class Close_Reason;&lt;BR /&gt;var Closures;&lt;BR /&gt;output out=closure1(where=(_type_=1)) sum=;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;/* Within Closed_Date (the midpoint) make highest sales come first */&lt;BR /&gt;proc sort data=closure1;&lt;BR /&gt;by Closed_Date descending Closures Close_Reason;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;/* The code below generates the default results. */&lt;/P&gt;&lt;P&gt;title1 'MTD Closures October 19, 2018';&lt;/P&gt;&lt;P&gt;legend1 label=('Close Reason') ;&lt;/P&gt;&lt;P&gt;pattern1 color=CX66A5A0 value=l3;&lt;BR /&gt;pattern2 color=CX7C95CA value=solid;&lt;BR /&gt;pattern3 color=CX94BDE1 value=solid;&lt;BR /&gt;pattern4 color=CXDE7E6F value=solid;&lt;BR /&gt;pattern5 color=CXA9865B value=r3;&lt;BR /&gt;pattern6 color=CXBABC5C value=solid;&lt;BR /&gt;pattern7 color=CXB689CD value=solid;&lt;BR /&gt;pattern8 color=CXCD7BA1 value=solid;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;axis1 label=none split='/' value=(height=1)&lt;BR /&gt;value=(height=.7 "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19");&lt;BR /&gt;axis2 minor=(number=3) label=(angle=90 height=1 "Total Closures")&lt;BR /&gt;value=(height=1 "0" "10" "20" "30" "40" "50" "60" "70" "80" "90" "100");&lt;/P&gt;&lt;P&gt;proc gchart data=closure1;&lt;BR /&gt;vbar Closed_Date / sumvar=Closures subgroup=Close_Reason legend=legend1&lt;BR /&gt;maxis=axis1 raxis=axis2 space=8&lt;BR /&gt;type = sum midpoints=('01oct2018'd to '19oct2018'd);&lt;BR /&gt;run;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/* The code below reorders the subgroups. */&lt;/P&gt;&lt;P&gt;goptions reset=all cback=white border htitle=12pt htext=12pt;&lt;/P&gt;&lt;P&gt;/* Create a RANK variable. This will be used as the SUMVAR= */&lt;BR /&gt;/* variable to ensure that the Close_Reason with the highest sales */&lt;BR /&gt;/* is drawn at the bottom of each bar. */&lt;/P&gt;&lt;P&gt;/* Assign a color and pattern value for each Close_Reason. */&lt;/P&gt;&lt;P&gt;/* Assign color and pattern values to a macro variable. Each */&lt;BR /&gt;/* observation creates one macro variable. This ensures that */&lt;BR /&gt;/* each Close_Reason has the same color and pattern across midpoints */&lt;BR /&gt;/* even though the RANK value is different for each Close_Reason. */&lt;BR /&gt;data closure2;&lt;BR /&gt;set closure1 end=eof;&lt;BR /&gt;by Closed_Date descending Closures Close_Reason;&lt;BR /&gt;length color $20 value $5;&lt;/P&gt;&lt;P&gt;Closed_Date = tranwrd(strip(Closed_Date)," ","/");&lt;BR /&gt;rank + 1;&lt;/P&gt;&lt;P&gt;select;&lt;BR /&gt;when (Close_Reason="Test") do;&lt;BR /&gt;color="CX66A5A0";&lt;BR /&gt;value="L3";&lt;BR /&gt;end;&lt;BR /&gt;when (Close_Reason="Test1") do;&lt;BR /&gt;color="CX7C95CA";&lt;BR /&gt;value="solid";&lt;BR /&gt;end;&lt;BR /&gt;when (Close_Reason="Test2") do;&lt;BR /&gt;color="CX94BDE1";&lt;BR /&gt;value="solid";&lt;BR /&gt;end;&lt;BR /&gt;when (Close_Reason="Test3") do;&lt;BR /&gt;color="CX9B58A6";&lt;BR /&gt;value="R3";&lt;BR /&gt;end;&lt;BR /&gt;when (Close_Reason="Test4") do;&lt;BR /&gt;color="CXBDB2BF";&lt;BR /&gt;value="solid";&lt;BR /&gt;end;&lt;BR /&gt;otherwise;&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;if eof then call symput('tot',trim(left(put(_n_,8.))));&lt;BR /&gt;call symput('pattern'||trim(left(put(_n_,8.))),'color=' || color || ' value=' || value ||';');&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;/* Define and execute the macro to create the PATTERN statements */&lt;BR /&gt;%macro pattern;&lt;BR /&gt;%do j=1 %to &amp;amp;tot;&lt;BR /&gt;pattern&amp;amp;j &amp;amp;&amp;amp;pattern&amp;amp;j;&lt;BR /&gt;%end;&lt;BR /&gt;%mend pattern;&lt;/P&gt;&lt;P&gt;%pattern;&lt;/P&gt;&lt;P&gt;/* Keep one observation for each Close_Reason */&lt;BR /&gt;proc sort data=closure2 out=unqshoes nodupkey;&lt;BR /&gt;by Close_Reason;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;/* Create macro variables to use in the legend. */&lt;BR /&gt;/* ORD contains the list of ranks that will be */&lt;BR /&gt;/* used in the ORDER= option. */&lt;BR /&gt;/* VAL contains the list of Close_Reason names that */&lt;BR /&gt;/* will be used in the VALUE= option. */&lt;BR /&gt;data _null_;&lt;BR /&gt;set unqshoes end=eof;&lt;BR /&gt;length ord val $600;&lt;BR /&gt;retain ord val ' ';&lt;/P&gt;&lt;P&gt;ord = trim(left(ord)) || ' ' || trim(left(put(rank,12.)));&lt;BR /&gt;val = trim(left(val)) || ' "' || Close_Reason || '"';&lt;/P&gt;&lt;P&gt;if eof then do;&lt;BR /&gt;call symput('ord', ord);&lt;BR /&gt;call symput('val', val);&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;title1 "MTD Closures October 19, 2018";&lt;/P&gt;&lt;P&gt;legend1 label=('Close Reason') order=(&amp;amp;ord) value=(j=l &amp;amp;val);&lt;/P&gt;&lt;P&gt;axis1 label=none split='/' value=(height=1)&lt;BR /&gt;value=(height=.7 "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19");&lt;BR /&gt;;&lt;BR /&gt;axis2 minor=(number=3) label=(angle=90 height=1.25 "Total Closures")&lt;BR /&gt;value=(height=1 "0" "10" "20" "30" "40" "50" "60" "70" "80" "90" "100");&lt;/P&gt;&lt;P&gt;proc gchart data=closure2;&lt;BR /&gt;vbar Closed_Date / sumvar=Closures subgroup=rank legend=legend1&lt;BR /&gt;maxis=axis1 raxis=axis2 space=.5&lt;BR /&gt;type = sum midpoints=('01oct2018'd to '19oct2018'd);&lt;BR /&gt;run;&lt;BR /&gt;quit;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Oct 2018 14:23:27 GMT</pubDate>
    <dc:creator>jwdenham</dc:creator>
    <dc:date>2018-10-23T14:23:27Z</dc:date>
    <item>
      <title>SEGLABELs for Stacked Column Chart</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SEGLABELs-for-Stacked-Column-Chart/m-p/506829#M1408</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having trouble implementing SEGLABELS for each segment and total above the bars in a stacked column chart. Could I get some assistance on how to implement this inside my code? The code prints 2 charts as you will see, the latter chart is the main chart in-use once&amp;nbsp;the previous code completes&amp;nbsp;it's final sort. Thank you for your time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* Set the graphics environment */&lt;BR /&gt;goptions reset=all cback=white border htitle=12pt htext=12pt;&lt;/P&gt;&lt;P&gt;/* Calculate totals for Closed_Date and Close_Reason */&lt;BR /&gt;proc means data=work.dailyclosures noprint;&lt;BR /&gt;by Closed_Date;&lt;BR /&gt;class Close_Reason;&lt;BR /&gt;var Closures;&lt;BR /&gt;output out=closure1(where=(_type_=1)) sum=;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;/* Within Closed_Date (the midpoint) make highest sales come first */&lt;BR /&gt;proc sort data=closure1;&lt;BR /&gt;by Closed_Date descending Closures Close_Reason;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;/* The code below generates the default results. */&lt;/P&gt;&lt;P&gt;title1 'MTD Closures October 19, 2018';&lt;/P&gt;&lt;P&gt;legend1 label=('Close Reason') ;&lt;/P&gt;&lt;P&gt;pattern1 color=CX66A5A0 value=l3;&lt;BR /&gt;pattern2 color=CX7C95CA value=solid;&lt;BR /&gt;pattern3 color=CX94BDE1 value=solid;&lt;BR /&gt;pattern4 color=CXDE7E6F value=solid;&lt;BR /&gt;pattern5 color=CXA9865B value=r3;&lt;BR /&gt;pattern6 color=CXBABC5C value=solid;&lt;BR /&gt;pattern7 color=CXB689CD value=solid;&lt;BR /&gt;pattern8 color=CXCD7BA1 value=solid;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;axis1 label=none split='/' value=(height=1)&lt;BR /&gt;value=(height=.7 "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19");&lt;BR /&gt;axis2 minor=(number=3) label=(angle=90 height=1 "Total Closures")&lt;BR /&gt;value=(height=1 "0" "10" "20" "30" "40" "50" "60" "70" "80" "90" "100");&lt;/P&gt;&lt;P&gt;proc gchart data=closure1;&lt;BR /&gt;vbar Closed_Date / sumvar=Closures subgroup=Close_Reason legend=legend1&lt;BR /&gt;maxis=axis1 raxis=axis2 space=8&lt;BR /&gt;type = sum midpoints=('01oct2018'd to '19oct2018'd);&lt;BR /&gt;run;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/* The code below reorders the subgroups. */&lt;/P&gt;&lt;P&gt;goptions reset=all cback=white border htitle=12pt htext=12pt;&lt;/P&gt;&lt;P&gt;/* Create a RANK variable. This will be used as the SUMVAR= */&lt;BR /&gt;/* variable to ensure that the Close_Reason with the highest sales */&lt;BR /&gt;/* is drawn at the bottom of each bar. */&lt;/P&gt;&lt;P&gt;/* Assign a color and pattern value for each Close_Reason. */&lt;/P&gt;&lt;P&gt;/* Assign color and pattern values to a macro variable. Each */&lt;BR /&gt;/* observation creates one macro variable. This ensures that */&lt;BR /&gt;/* each Close_Reason has the same color and pattern across midpoints */&lt;BR /&gt;/* even though the RANK value is different for each Close_Reason. */&lt;BR /&gt;data closure2;&lt;BR /&gt;set closure1 end=eof;&lt;BR /&gt;by Closed_Date descending Closures Close_Reason;&lt;BR /&gt;length color $20 value $5;&lt;/P&gt;&lt;P&gt;Closed_Date = tranwrd(strip(Closed_Date)," ","/");&lt;BR /&gt;rank + 1;&lt;/P&gt;&lt;P&gt;select;&lt;BR /&gt;when (Close_Reason="Test") do;&lt;BR /&gt;color="CX66A5A0";&lt;BR /&gt;value="L3";&lt;BR /&gt;end;&lt;BR /&gt;when (Close_Reason="Test1") do;&lt;BR /&gt;color="CX7C95CA";&lt;BR /&gt;value="solid";&lt;BR /&gt;end;&lt;BR /&gt;when (Close_Reason="Test2") do;&lt;BR /&gt;color="CX94BDE1";&lt;BR /&gt;value="solid";&lt;BR /&gt;end;&lt;BR /&gt;when (Close_Reason="Test3") do;&lt;BR /&gt;color="CX9B58A6";&lt;BR /&gt;value="R3";&lt;BR /&gt;end;&lt;BR /&gt;when (Close_Reason="Test4") do;&lt;BR /&gt;color="CXBDB2BF";&lt;BR /&gt;value="solid";&lt;BR /&gt;end;&lt;BR /&gt;otherwise;&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;if eof then call symput('tot',trim(left(put(_n_,8.))));&lt;BR /&gt;call symput('pattern'||trim(left(put(_n_,8.))),'color=' || color || ' value=' || value ||';');&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;/* Define and execute the macro to create the PATTERN statements */&lt;BR /&gt;%macro pattern;&lt;BR /&gt;%do j=1 %to &amp;amp;tot;&lt;BR /&gt;pattern&amp;amp;j &amp;amp;&amp;amp;pattern&amp;amp;j;&lt;BR /&gt;%end;&lt;BR /&gt;%mend pattern;&lt;/P&gt;&lt;P&gt;%pattern;&lt;/P&gt;&lt;P&gt;/* Keep one observation for each Close_Reason */&lt;BR /&gt;proc sort data=closure2 out=unqshoes nodupkey;&lt;BR /&gt;by Close_Reason;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;/* Create macro variables to use in the legend. */&lt;BR /&gt;/* ORD contains the list of ranks that will be */&lt;BR /&gt;/* used in the ORDER= option. */&lt;BR /&gt;/* VAL contains the list of Close_Reason names that */&lt;BR /&gt;/* will be used in the VALUE= option. */&lt;BR /&gt;data _null_;&lt;BR /&gt;set unqshoes end=eof;&lt;BR /&gt;length ord val $600;&lt;BR /&gt;retain ord val ' ';&lt;/P&gt;&lt;P&gt;ord = trim(left(ord)) || ' ' || trim(left(put(rank,12.)));&lt;BR /&gt;val = trim(left(val)) || ' "' || Close_Reason || '"';&lt;/P&gt;&lt;P&gt;if eof then do;&lt;BR /&gt;call symput('ord', ord);&lt;BR /&gt;call symput('val', val);&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;title1 "MTD Closures October 19, 2018";&lt;/P&gt;&lt;P&gt;legend1 label=('Close Reason') order=(&amp;amp;ord) value=(j=l &amp;amp;val);&lt;/P&gt;&lt;P&gt;axis1 label=none split='/' value=(height=1)&lt;BR /&gt;value=(height=.7 "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19");&lt;BR /&gt;;&lt;BR /&gt;axis2 minor=(number=3) label=(angle=90 height=1.25 "Total Closures")&lt;BR /&gt;value=(height=1 "0" "10" "20" "30" "40" "50" "60" "70" "80" "90" "100");&lt;/P&gt;&lt;P&gt;proc gchart data=closure2;&lt;BR /&gt;vbar Closed_Date / sumvar=Closures subgroup=rank legend=legend1&lt;BR /&gt;maxis=axis1 raxis=axis2 space=.5&lt;BR /&gt;type = sum midpoints=('01oct2018'd to '19oct2018'd);&lt;BR /&gt;run;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 14:23:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SEGLABELs-for-Stacked-Column-Chart/m-p/506829#M1408</guid>
      <dc:creator>jwdenham</dc:creator>
      <dc:date>2018-10-23T14:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: SEGLABELs for Stacked Column Chart</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SEGLABELs-for-Stacked-Column-Chart/m-p/507175#M1432</link>
      <description>&lt;P&gt;Solved with:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc gchart data=closure2;&lt;BR /&gt;vbar Closed_Date / sumvar=Closures subgroup=rank legend=legend1&lt;BR /&gt;maxis=axis1 raxis=axis2 space=.5&lt;BR /&gt;CLIPREF&lt;BR /&gt;FRAME&lt;BR /&gt;DISCRETE&lt;BR /&gt;TYPE=SUM&lt;BR /&gt;OUTSIDE=SUM&lt;BR /&gt;NOZERO&lt;BR /&gt;INSIDE=SUM&lt;/P&gt;&lt;P&gt;type = sum midpoints=('01oct2018'd to '23oct2018'd);&lt;BR /&gt;run;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;</description>
      <pubDate>Wed, 24 Oct 2018 14:44:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SEGLABELs-for-Stacked-Column-Chart/m-p/507175#M1432</guid>
      <dc:creator>jwdenham</dc:creator>
      <dc:date>2018-10-24T14:44:34Z</dc:date>
    </item>
  </channel>
</rss>

