<?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: keylegend order when format is used in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/keylegend-order-when-format-is-used/m-p/432668#M14935</link>
    <description>I just found the answer, sorting the file first did the trick!</description>
    <pubDate>Wed, 31 Jan 2018 10:44:20 GMT</pubDate>
    <dc:creator>vstorme</dc:creator>
    <dc:date>2018-01-31T10:44:20Z</dc:date>
    <item>
      <title>keylegend order when format is used</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/keylegend-order-when-format-is-used/m-p/432665#M14934</link>
      <description>&lt;P&gt;Dear,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used the code from Rick Wicklin to produce a funnel plot which works really nice. However, In addition I have a grouping variable for which I used a format, but I can't get the order correct of the legend. This is my code (I use SAS 9.4):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data = &amp;amp;lib..Funnel out = sortfunnel;
by mycap;
run;

/*--Make control data set for format--*/
data myfmt;
 set sortfunnel;
    by mycap;
 if first.mycap then do;
    fmtname='typefmt';
    start=mycap;
    label=label;
output;
end;
run;
data myfmt (keep=fmtname start label mycap);
set myfmt ;
if start=. then delete;
run;
/*--Create format--*/
proc format cntlin=myfmt;
run;

/* 4. Plot proportions versus sample size. Overlay control limits */
ods rtf file = "&amp;amp;path.funnelplot.rtf" style=analysis;
options orientation=landscape;
title "My Title";
proc sgplot data=&amp;amp;lib..Funnel NOCYCLEATTRS ;
styleattrs datacontrastcolors=(LILG BILG STLG VILG DELG) ;
band x=N lower=L3sd upper=U3sd / nofill lineattrs=(color=lipk) legendlabel="99.8% limits" name="band99";
band x=N lower=L2sd upper=U2sd / nofill lineattrs=(color=gray) legendlabel="95% limits" name="band95";
refline &amp;amp;AvgProp / axis=y lineattrs=(pattern=longdash color=blue);
scatter x=Trials y=Proportion / group = mycap 
								markerattrs=(symbol=circlefilled size=5 )
								legendlabel="capaciteit" name="cap";
keylegend "band95" "band99" / location=inside position=bottomright;
keylegend "cap" / location=inside position=right  title='capaciteit';
yaxis grid values=(0 to 1 by 0.1) label = "tekst voor Y-as"; 
xaxis grid label = "tekst voor X-as";
format mycap typefmt.;
run;
ods rtf close;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Jan 2018 10:38:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/keylegend-order-when-format-is-used/m-p/432665#M14934</guid>
      <dc:creator>vstorme</dc:creator>
      <dc:date>2018-01-31T10:38:03Z</dc:date>
    </item>
    <item>
      <title>Re: keylegend order when format is used</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/keylegend-order-when-format-is-used/m-p/432668#M14935</link>
      <description>I just found the answer, sorting the file first did the trick!</description>
      <pubDate>Wed, 31 Jan 2018 10:44:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/keylegend-order-when-format-is-used/m-p/432668#M14935</guid>
      <dc:creator>vstorme</dc:creator>
      <dc:date>2018-01-31T10:44:20Z</dc:date>
    </item>
  </channel>
</rss>

