<?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: Proc Sgplot with group - display all values in legend in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/681029#M20447</link>
    <description>&lt;P&gt;Looking at this again, I'm still not sure of the behavior of the EXPECTED values. Can these values vary per date, or are they always constant? Or, do they accumulate with your TOTAL values?&lt;/P&gt;</description>
    <pubDate>Wed, 02 Sep 2020 15:12:06 GMT</pubDate>
    <dc:creator>DanH_sas</dc:creator>
    <dc:date>2020-09-02T15:12:06Z</dc:date>
    <item>
      <title>Proc Sgplot with group - display all values in legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/678445#M20387</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm having troubles displaying the values in a Legend correctly - basically as I'm&amp;nbsp;using a GROUP, the Legend repeats the values twice.&lt;/P&gt;
&lt;P&gt;Here is an example of my data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV style="direction: ltr;"&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
   input Date $ Status $ Expected Total;                                                                                                                 
   datalines;   

20AUG Received 15 15
20AUG Replic . 0
19AUG Replic . 10
19AUG Received 15 145
18AUG Replic . 0
18AUG Received 15 15
17AUG Replic . 0
17AUG Received 15 15
14AUG Replic . 0
14AUG Received 15 15
13AUG Received 15 15
13AUG Replic . 0
12AUG Received 15 15
12AUG Replic . 015
11AUG Received 15 135
11AUG Replic . 20
10AUG Received 15 15
10AUG Replic . 0
07AUG Received	15	15
07AUG Replic . 0
06AUG Replic . 0
06AUG Received 15 15

;run;

proc sgplot data=WORK.TEST ;
	vbar Date / name="STATUS" group=status response=TOTAL groupdisplay=stack   ;
	vline Date / response=EXPECTED group=status  name="Expected"
                 lineattrs=(thickness=3 color=deeppink pattern=dash) transparency=0.1;
				 xaxis display=(nolabel)  DISCRETEORDER=data fitpolicy=thin type=discrete ;
				 keylegend "STATUS"  "Expected";
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;DIV style="direction: ltr;"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="direction: ltr;"&gt;the output looks like this:&lt;/DIV&gt;
&lt;DIV style="direction: ltr;"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Untitled picture.png" style="width: 645px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/48525iD1DAFC48A8B656F7/image-size/large?v=v2&amp;amp;px=999" role="button" title="Untitled picture.png" alt="Untitled picture.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;
&lt;DIV style="direction: ltr;"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;In the legend, I'm happy with "Received" and "Replic", but I'd like to only see one dotted line, saying "Expected".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I cannot remove the GROUP as I would lose the distinction between "Received" and "Replic".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ps: In the forum I found there are solution if using EG 9 and above, but I'm using EG 7.13&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 14:09:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/678445#M20387</guid>
      <dc:creator>MART1</dc:creator>
      <dc:date>2020-08-21T14:09:13Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sgplot with group - display all values in legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/678476#M20391</link>
      <description>&lt;P&gt;You can remove the "Expected" from the KeyLegend&lt;/P&gt;
&lt;PRE&gt; keylegend "STATUS"; /*  "Expected"; */&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Aug 2020 15:10:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/678476#M20391</guid>
      <dc:creator>RichardDeVen</dc:creator>
      <dc:date>2020-08-21T15:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sgplot with group - display all values in legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/678487#M20393</link>
      <description>&lt;P&gt;Instead of adding the VLINE, add a custom LEGENDITEM entry for the line. Do something like the following:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=WORK.TEST ;
	vbar Date / name="STATUS" group=status response=TOTAL groupdisplay=stack   ;
	vline Date / response=EXPECTED group=status  name="Expected"
                 lineattrs=(thickness=3 color=deeppink pattern=dash) transparency=0.1;
			     xaxis display=(nolabel)  DISCRETEORDER=data fitpolicy=thin type=discrete ;
    legenditem type=line name="MyLine" / lineattrs=(thickness=3 color=deeppink pattern=dash)
                                         label="Expected";
	keylegend "STATUS"  "MyLine";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The LEGENDITEM statement requires at least SAS v9.4m5.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;Dan&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 15:36:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/678487#M20393</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2020-08-21T15:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sgplot with group - display all values in legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/678494#M20394</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12477"&gt;@RichardDeVen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This however would not show the dotted line with the "Expected" - as I need to show "Received" "Replic" "Expected"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 15:47:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/678494#M20394</guid>
      <dc:creator>MART1</dc:creator>
      <dc:date>2020-08-21T15:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sgplot with group - display all values in legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/678495#M20395</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15130"&gt;@DanH_sas&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did see the LEGENDITEM&amp;nbsp;on one of your posts actually - unfortunately I'm on EG7.13 !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any chance there is something working in a similar way for older versions??&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 15:50:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/678495#M20395</guid>
      <dc:creator>MART1</dc:creator>
      <dc:date>2020-08-21T15:50:52Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sgplot with group - display all values in legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/678501#M20396</link>
      <description>&lt;P&gt;What do you get in your log when you submit the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%put &amp;amp;sysvlong;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 16:28:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/678501#M20396</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2020-08-21T16:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sgplot with group - display all values in legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/678502#M20397</link>
      <description>&lt;P&gt;Since your thresholds per group are constant, you could run a small data step on your input data to put the threshold values into two columns. Then, use two REFLINES statements that refer to each of these two columns. In the legend, refer to only one of the REFLINEs. Set LEGENDLABEL="Expected" on the referred REFLINE statement.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 16:37:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/678502#M20397</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2020-08-21T16:37:25Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sgplot with group - display all values in legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/678507#M20398</link>
      <description>&lt;P&gt;hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15130"&gt;@DanH_sas&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;that's confusing!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the log shows&amp;nbsp; 9.04.01M4P110916, but in the "About SAS" I see Version: 7.13&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm quite new to SAS but I don't understand how this could be??&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks&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;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 16:53:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/678507#M20398</guid>
      <dc:creator>MART1</dc:creator>
      <dc:date>2020-08-21T16:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sgplot with group - display all values in legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/678509#M20399</link>
      <description>&lt;P&gt;This means that this version of EG is using SAS v9.4m4, which means you cannot use the LEGENDITEM approach. You can try the alternate approach I proposed using REFLINEs.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 16:58:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/678509#M20399</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2020-08-21T16:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sgplot with group - display all values in legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/681017#M20445</link>
      <description>&lt;P&gt;thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15130"&gt;@DanH_sas&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you mean transposing the table as below?&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-center" image-alt="REPL.png" style="width: 390px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/48889i0084234EA3326771/image-size/large?v=v2&amp;amp;px=999" role="button" title="REPL.png" alt="REPL.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;however if I do so, I will lose the ability to show Received and Replicated as a&amp;nbsp;stacked bar? (apologies I'm still quite new to this)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2020 14:37:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/681017#M20445</guid>
      <dc:creator>MART1</dc:creator>
      <dc:date>2020-09-02T14:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sgplot with group - display all values in legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/681026#M20446</link>
      <description>sorry forgot to add: the issue with REFLINE is that it requires a unique value, however my Expected can change over time</description>
      <pubDate>Wed, 02 Sep 2020 15:02:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/681026#M20446</guid>
      <dc:creator>MART1</dc:creator>
      <dc:date>2020-09-02T15:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sgplot with group - display all values in legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/681029#M20447</link>
      <description>&lt;P&gt;Looking at this again, I'm still not sure of the behavior of the EXPECTED values. Can these values vary per date, or are they always constant? Or, do they accumulate with your TOTAL values?&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2020 15:12:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/681029#M20447</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2020-09-02T15:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sgplot with group - display all values in legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/681034#M20448</link>
      <description>&lt;P&gt;The following should get you what you want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
   input Date $ Status $ Expected Total;                                        
                                                                         
   datalines;   

20AUG Received 15 15
20AUG Replic   .  0
19AUG Replic   .  10
19AUG Received 15 145
18AUG Replic   .  0
18AUG Received 15 15
17AUG Replic   .  0
17AUG Received 15 15
14AUG Replic   .  0
14AUG Received 15 15
13AUG Received 15 15
13AUG Replic   .  0
12AUG Received 15 15
12AUG Replic   .  0
11AUG Received 15 135
11AUG Replic   .  20
10AUG Received 15 15
10AUG Replic   .  0
07AUG Received 15 15
07AUG Replic   .  0 
06AUG Replic   .  0
06AUG Received 15 15

;run;

proc sgplot data=WORK.TEST ;
   vbarbasic Date / name="STATUS" group=status response=TOTAL groupdisplay=stack
 grouporder=ascending  ;
   highlow x=Date high=Expected low=Expected / type=bar nofill name="Expected" l
egendlabel="Expected"
           lineattrs=(thickness=3 color=deeppink pattern=dash) transparency=0.1;
   keylegend "STATUS"  "Expected";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;Dan&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2020 15:34:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/681034#M20448</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2020-09-02T15:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sgplot with group - display all values in legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/681050#M20449</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15130"&gt;@DanH_sas&lt;/a&gt;&amp;nbsp;that's amazing, works a treat!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Never seen some of the commands you are using; very interesting many thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Re the expected, it is an independent value that can change over time (so&amp;nbsp;the system expects a number of files every day; if the sum of the Received and Replic will match the Expected the system is working ok, but that's not a guarantee of course).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;again may thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2020 16:13:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgplot-with-group-display-all-values-in-legend/m-p/681050#M20449</guid>
      <dc:creator>MART1</dc:creator>
      <dc:date>2020-09-02T16:13:19Z</dc:date>
    </item>
  </channel>
</rss>

