<?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: Create separate keylegends in sgpanel in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Create-separate-keylegends-in-sgpanel/m-p/857666#M23477</link>
    <description>&lt;P&gt;Try this EXCLUDE trick in the KEYLEGEND statement and see if it works for you:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgpanel;
styleattrs datacolors=(blue lightred grey brown white)
   datalinepatterns=(solid);
panelby parameter Demographics1 /novarname noheaderborder
   headerattrs=(size=18pt weight=bold)
   layout=lattice colheaderpos=bottom;
vbarparm category=threshold response=prevalence /
  group=Demographics2 groupdisplay=cluster name="bar"
   dataskin=crisp grouporder=ascending;
colaxis discreteorder=data
  display=(noticks nolabel)
  valueattrs=(size=16pt weight=bold);
rowaxis label='Percent'
  labelattrs=(size=24pt weight=bold)
  valueattrs=(size=16pt weight=bold)
  values=(0 to 80 by 20);
keylegend "bar" / position=topleft autoitemsize across=1
  title="" sortorder=ascending
  exclude=("Female" "Male")
  titleattrs=(Family=Arial Size=12 Weight=Bold)
  valueattrs=(Family=Arial Size=18 Weight=Bold);
keylegend "bar" / position=topright autoitemsize across=1
  title="" sortorder=ascending
  exclude=("Black" "Mexican" "White")
  titleattrs=(Family=Arial Size=12 Weight=Bold)
  valueattrs=(Family=Arial Size=18 Weight=Bold);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 07 Feb 2023 21:01:29 GMT</pubDate>
    <dc:creator>DanH_sas</dc:creator>
    <dc:date>2023-02-07T21:01:29Z</dc:date>
    <item>
      <title>Create separate keylegends in sgpanel</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Create-separate-keylegends-in-sgpanel/m-p/857629#M23476</link>
      <description>&lt;P&gt;I would like to have 2 keylegends in a 2-panel graph in Proc SGPANEL (see code below). As you may note in the figure below, the keylegends is not sorted by the demographics1 or demographics2. Sorting the data by these 2 variables did not make a difference. Is there any way to make 2 separate legends by the variable demographics1: one for the gender, and the other for race?&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sgpanel&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;styleattrs datacolors=(blue lightred grey brown white)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; datalinepatterns=(solid);&lt;/P&gt;
&lt;P&gt;panelby parameter Demographics1 /novarname noheaderborder&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; headerattrs=(size=&lt;STRONG&gt;18&lt;/STRONG&gt;pt weight=bold)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; layout=lattice colheaderpos=bottom;&lt;/P&gt;
&lt;P&gt;vbarparm category=threshold response=prevalence /&lt;/P&gt;
&lt;P&gt;&amp;nbsp; group=Demographics2 groupdisplay=cluster&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; dataskin=crisp grouporder=ascending;&lt;/P&gt;
&lt;P&gt;colaxis discreteorder=data&lt;/P&gt;
&lt;P&gt;&amp;nbsp; display=(noticks nolabel)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; valueattrs=(size=&lt;STRONG&gt;16&lt;/STRONG&gt;pt weight=bold);&lt;/P&gt;
&lt;P&gt;rowaxis label='Percent'&lt;/P&gt;
&lt;P&gt;&amp;nbsp; labelattrs=(size=&lt;STRONG&gt;24&lt;/STRONG&gt;pt weight=bold)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; valueattrs=(size=&lt;STRONG&gt;16&lt;/STRONG&gt;pt weight=bold)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; values=(&lt;STRONG&gt;0&lt;/STRONG&gt; to &lt;STRONG&gt;80&lt;/STRONG&gt; by &lt;STRONG&gt;20&lt;/STRONG&gt;);&lt;/P&gt;
&lt;P&gt;keylegend /position=top autoitemsize down=&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; title="" sortorder=ascending&lt;/P&gt;
&lt;P&gt;&amp;nbsp; titleattrs=(Family=Arial Size=&lt;STRONG&gt;12&lt;/STRONG&gt; Weight=Bold)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; valueattrs=(Family=Arial Size=&lt;STRONG&gt;18&lt;/STRONG&gt; Weight=Bold);&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&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-inline" image-alt="Jason2020_0-1675793504014.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/80180i3E6FD1E156C1E392/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Jason2020_0-1675793504014.png" alt="Jason2020_0-1675793504014.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 18:19:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Create-separate-keylegends-in-sgpanel/m-p/857629#M23476</guid>
      <dc:creator>Jason2020</dc:creator>
      <dc:date>2023-02-07T18:19:24Z</dc:date>
    </item>
    <item>
      <title>Re: Create separate keylegends in sgpanel</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Create-separate-keylegends-in-sgpanel/m-p/857666#M23477</link>
      <description>&lt;P&gt;Try this EXCLUDE trick in the KEYLEGEND statement and see if it works for you:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgpanel;
styleattrs datacolors=(blue lightred grey brown white)
   datalinepatterns=(solid);
panelby parameter Demographics1 /novarname noheaderborder
   headerattrs=(size=18pt weight=bold)
   layout=lattice colheaderpos=bottom;
vbarparm category=threshold response=prevalence /
  group=Demographics2 groupdisplay=cluster name="bar"
   dataskin=crisp grouporder=ascending;
colaxis discreteorder=data
  display=(noticks nolabel)
  valueattrs=(size=16pt weight=bold);
rowaxis label='Percent'
  labelattrs=(size=24pt weight=bold)
  valueattrs=(size=16pt weight=bold)
  values=(0 to 80 by 20);
keylegend "bar" / position=topleft autoitemsize across=1
  title="" sortorder=ascending
  exclude=("Female" "Male")
  titleattrs=(Family=Arial Size=12 Weight=Bold)
  valueattrs=(Family=Arial Size=18 Weight=Bold);
keylegend "bar" / position=topright autoitemsize across=1
  title="" sortorder=ascending
  exclude=("Black" "Mexican" "White")
  titleattrs=(Family=Arial Size=12 Weight=Bold)
  valueattrs=(Family=Arial Size=18 Weight=Bold);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Feb 2023 21:01:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Create-separate-keylegends-in-sgpanel/m-p/857666#M23477</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2023-02-07T21:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: Create separate keylegends in sgpanel</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Create-separate-keylegends-in-sgpanel/m-p/857674#M23478</link>
      <description>&lt;P&gt;Hi Dan,&lt;/P&gt;
&lt;P&gt;It actually worked. I did however get an error message, that "topright" and "topleft" were not acceptable, so I used "top" and "bottom" instead. Here is how the figure looks now.&lt;/P&gt;
&lt;P&gt;Thank you very much for your help.&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-inline" image-alt="Jason2020_0-1675807528989.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/80194i2766C46857CEEEFB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Jason2020_0-1675807528989.png" alt="Jason2020_0-1675807528989.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 22:06:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Create-separate-keylegends-in-sgpanel/m-p/857674#M23478</guid>
      <dc:creator>Jason2020</dc:creator>
      <dc:date>2023-02-07T22:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: Create separate keylegends in sgpanel</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Create-separate-keylegends-in-sgpanel/m-p/857677#M23479</link>
      <description>&lt;P&gt;Ah, yes...sorry about that. Those values are supported in SGPLOT, but not SGPANEL. The way you have them arranged looks better anyway :-).&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 23:08:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Create-separate-keylegends-in-sgpanel/m-p/857677#M23479</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2023-02-07T23:08:53Z</dc:date>
    </item>
  </channel>
</rss>

