<?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 sgpanel legend for group variable location=outside in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgpanel-legend-for-group-variable-location-outside/m-p/425587#M14676</link>
    <description>&lt;P&gt;Great!!! Thanks Pgstat and Reeza. Below is the code with your inputs reflected. One last thing, because chart is getting large in size, I'd like to have&amp;nbsp;ROWHEADERPOS=both COLHEADERPOS=both options for easire eyeballing. Currently, row and col headers I guess are interfered by axis titles at left and bottom. Is there anyway to have row/col headers stick to the body of the chart? not split by axis titles?&amp;nbsp; Like in the image?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HEADERS BOTH.png" style="width: 284px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17679i418D3BB383FA3572/image-size/large?v=v2&amp;amp;px=999" role="button" title="HEADERS BOTH.png" alt="HEADERS BOTH.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;proc sort data=b.plotdata; by race agegroup bf year; run;&lt;BR /&gt;ods graphics / height=1200 width=4000;&lt;BR /&gt;proc sgpanel data=plotdata1;&lt;BR /&gt;panelby race agegroup/ novarname onepanel LAYOUT=LATTICE ROWHEADERPOS=both COLHEADERPOS=both;&lt;BR /&gt;series y=pr_obs x=year / group=bf lineattrs=(pattern=solid);&lt;BR /&gt;keylegend/&amp;nbsp; title="Categories" position=bottom;&lt;BR /&gt;*format race race. agegroup agegroup. bf bf.;&lt;BR /&gt;colaxis label='YEARS' fitpolicy=thin valuesformat=best4.0 values=(2002 to 2015 by 1);&lt;BR /&gt;rowaxis label='PREVALENCE OF DISEASE' grid;&lt;BR /&gt;title "TITLE";&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Sun, 07 Jan 2018 13:05:35 GMT</pubDate>
    <dc:creator>Cruise</dc:creator>
    <dc:date>2018-01-07T13:05:35Z</dc:date>
    <item>
      <title>proc sgpanel legend for group variable location=outside</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgpanel-legend-for-group-variable-location-outside/m-p/425567#M14672</link>
      <description>&lt;P&gt;I have two major and few other minor problems in this plot. Major problems first. Each panel supposed to present line chart by 5 level of categorical variable, 'BF categories'. Instead these tangled lines appeared which doesn't make sense. I'd like to have each lines in each panel in different colors associated with a Legend outside the panel with information as below.&lt;/P&gt;&lt;P&gt;Any suggestions please? Attached is the summary data from a sampled data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Legend:&lt;/P&gt;&lt;P&gt;&amp;nbsp;red: 1-3 months&lt;/P&gt;&lt;P&gt;&amp;nbsp;blue: 4-9 months&lt;/P&gt;&lt;P&gt;&amp;nbsp;green: 10-12 months&lt;/P&gt;&lt;P&gt;&amp;nbsp;brown: 13-24 months&lt;/P&gt;&lt;P&gt;et.c&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="SGPanel58.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17677iBE656536EE393704/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPanel58.png" alt="SGPanel58.png" /&gt;&lt;/span&gt;&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;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC IMPORT DATAFILE= "...\plotdata.txt" 
			OUT= B.plotdata
            DBMS=DLM REPLACE;
            GETNAMES=YES;
RUN;
proc sgpanel data=plotdata; 
panelby race agegroup/ novarname onepanel LAYOUT=LATTICE columns=5 ROWHEADERPOS=right; 
series y=pr_obs x=year/group=bf;
keylegend/  title="BF categories" position=bottom location=outside;
format race race. agegroup agegroup. year 4.0 bf bf.;
colaxis label='COHORT YEARS' fitpolicy=thin grid;
rowaxis label='PREVALENCE OF DISEASE' grid;
title 'PREVALENCE OF 'X' BY COHORT YEAR, AGE AND RACE'; 
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jan 2018 03:28:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgpanel-legend-for-group-variable-location-outside/m-p/425567#M14672</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2018-01-07T03:28:10Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgpanel legend for group variable location=outside</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgpanel-legend-for-group-variable-location-outside/m-p/425568#M14673</link>
      <description>&lt;P&gt;What variable do you have that specifies those three groups you want. Don’t see anything relevant in the data.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jan 2018 03:13:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgpanel-legend-for-group-variable-location-outside/m-p/425568#M14673</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-07T03:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgpanel legend for group variable location=outside</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgpanel-legend-for-group-variable-location-outside/m-p/425571#M14674</link>
      <description>Reeza, the variable 'bf' which has 6 levels. Legend with 3 levels in my post wasn't meant to be exact.</description>
      <pubDate>Sun, 07 Jan 2018 03:22:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgpanel-legend-for-group-variable-location-outside/m-p/425571#M14674</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2018-01-07T03:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgpanel legend for group variable location=outside</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgpanel-legend-for-group-variable-location-outside/m-p/425575#M14675</link>
      <description>&lt;P&gt;I fixed a few minor problems in this version&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC IMPORT DATAFILE= "&amp;amp;sasforum\datasets\plotdata.txt" 
			OUT= plotdata
            DBMS=DLM REPLACE;
            GETNAMES=YES;
RUN;

proc sort data=plotdata; by race agegroup bf year; run;

ods graphics / height=1200 width=1200;
proc sgpanel data=plotdata; 
panelby race agegroup/ novarname onepanel LAYOUT=LATTICE ROWHEADERPOS=right; 
series y=pr_obs x=year / group=bf lineattrs=(pattern=solid);
keylegend/  title="BF categories" position=bottom;
*format race race. agegroup agegroup. year 4.0 bf bf.;
colaxis label='COHORT YEARS' fitpolicy=thin valuesformat=best4.0;
rowaxis label='PREVALENCE OF DISEASE';
title "PREVALENCE OF 'X' BY COHORT YEAR, AGE AND RACE"; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="SGPanel3.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17678i86DF8A6C31C96646/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPanel3.png" alt="SGPanel3.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jan 2018 04:39:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgpanel-legend-for-group-variable-location-outside/m-p/425575#M14675</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-01-07T04:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgpanel legend for group variable location=outside</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgpanel-legend-for-group-variable-location-outside/m-p/425587#M14676</link>
      <description>&lt;P&gt;Great!!! Thanks Pgstat and Reeza. Below is the code with your inputs reflected. One last thing, because chart is getting large in size, I'd like to have&amp;nbsp;ROWHEADERPOS=both COLHEADERPOS=both options for easire eyeballing. Currently, row and col headers I guess are interfered by axis titles at left and bottom. Is there anyway to have row/col headers stick to the body of the chart? not split by axis titles?&amp;nbsp; Like in the image?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HEADERS BOTH.png" style="width: 284px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17679i418D3BB383FA3572/image-size/large?v=v2&amp;amp;px=999" role="button" title="HEADERS BOTH.png" alt="HEADERS BOTH.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;proc sort data=b.plotdata; by race agegroup bf year; run;&lt;BR /&gt;ods graphics / height=1200 width=4000;&lt;BR /&gt;proc sgpanel data=plotdata1;&lt;BR /&gt;panelby race agegroup/ novarname onepanel LAYOUT=LATTICE ROWHEADERPOS=both COLHEADERPOS=both;&lt;BR /&gt;series y=pr_obs x=year / group=bf lineattrs=(pattern=solid);&lt;BR /&gt;keylegend/&amp;nbsp; title="Categories" position=bottom;&lt;BR /&gt;*format race race. agegroup agegroup. bf bf.;&lt;BR /&gt;colaxis label='YEARS' fitpolicy=thin valuesformat=best4.0 values=(2002 to 2015 by 1);&lt;BR /&gt;rowaxis label='PREVALENCE OF DISEASE' grid;&lt;BR /&gt;title "TITLE";&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jan 2018 13:05:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgpanel-legend-for-group-variable-location-outside/m-p/425587#M14676</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2018-01-07T13:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgpanel legend for group variable location=outside</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgpanel-legend-for-group-variable-location-outside/m-p/425633#M14677</link>
      <description>&lt;P&gt;It would look even worse with row headers on the outside. Perhaps the PANEL layout would be better for your graph.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods graphics / &lt;FONT color="#ff6600"&gt;height=1400&lt;/FONT&gt; width=1200;
proc sgpanel data=plotdata; 
panelby race agegroup/ novarname onepanel &lt;FONT color="#ff6600"&gt;LAYOUT=Panel columns=5&lt;/FONT&gt;; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 07 Jan 2018 22:53:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgpanel-legend-for-group-variable-location-outside/m-p/425633#M14677</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-01-07T22:53:42Z</dc:date>
    </item>
  </channel>
</rss>

