<?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: Assigning legend labels by group in plot in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Assigning-legend-labels-by-group-in-plot/m-p/188911#M6964</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Code you used would help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 05 Sep 2014 19:25:04 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2014-09-05T19:25:04Z</dc:date>
    <item>
      <title>Assigning legend labels by group in plot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Assigning-legend-labels-by-group-in-plot/m-p/188910#M6963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a plot that I'm creating using longitudinal data from 15 patients. Each patient is followed up for at most 7 time points. Each patient can belong into one of three groups. I can create the graph where patients in similar groups will have the same color and line patterns. However, I cannot seem to assign the legend labels properly. To further describe the creation of the plot, I created individual columns for each of the three groups. Some rows will be blank, of course, since some patients will be in other groups. I used sgrender to plot x = time and y = value BY PT. This got me the individual curves for each of the 15 patients. However, in doing this, SAS assigns a legend item to each patient, when I really want to assign only 3 categories defined by each GROUP. Is there a fix for this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is what I have so far:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="7325" alt="SGRender129.png" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/7325_SGRender129.png" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code used to generate this is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc template;&lt;/P&gt;&lt;P&gt;define statgraph sgplot1;&lt;/P&gt;&lt;P&gt;begingraph /;&lt;/P&gt;&lt;P&gt;layout overlay / xaxisopts=(label = "Follow-up period" linearopts = (viewmax=7.7 tickvaluelist=(1 2 3 4 5 6 7))) yaxisopts=(linearopts=(viewmin=0)) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; SeriesPlot X=time Y=level1val / display = all primary=true Group=pt lineattrs = (Color=CX008000 pattern=20) Markerattrs=( Color=CX008000 Symbol=ASTERISK)&amp;nbsp; LegendLabel="Level 1" NAME="Dose";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; SeriesPlot X=time Y=level2val / display = all Group=pt lineattrs = (Color=CX000000 pattern=1) Markerattrs=( Color=CX000000 Symbol=CIRCLE)&amp;nbsp; LegendLabel="Level 2" NAME="Dose";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; SeriesPlot X=time Y=level3val / display = all Group=pt lineattrs = (Color=CXFF0000 pattern=2) Markerattrs=(Color=CXFF0000 Symbol=TRIANGLE)&amp;nbsp; LegendLabel="Level 3" NAME="Dose";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; beginpolyline x = 7.4 y = 1.27/drawspace = datavalue lineattrs=(color=CX000000 thickness=1.5);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; draw x = 7.5 y = 1.27/drawspace = datavalue;&lt;/P&gt;&lt;P&gt;&amp;nbsp; draw x = 7.5 y = 0.64/drawspace = datavalue;&lt;/P&gt;&lt;P&gt;&amp;nbsp; draw x = 7.4 y = 0.64/drawspace = datavalue;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; endpolyline;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; drawtext&amp;nbsp; textattrs=(size = 9pt) "0.64" /x = 7.5 y = 0.60 drawspace = datavalue;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; drawtext&amp;nbsp; textattrs=(size = 9pt) "1.27"/x = 7.5 y = 1.30 drawspace = datavalue;&lt;/P&gt;&lt;P&gt;endlayout;&lt;/P&gt;&lt;P&gt;endgraph;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sgrender template = sgplot1 data = creat;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Sep 2014 19:21:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Assigning-legend-labels-by-group-in-plot/m-p/188910#M6963</guid>
      <dc:creator>JohnPura</dc:creator>
      <dc:date>2014-09-05T19:21:28Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning legend labels by group in plot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Assigning-legend-labels-by-group-in-plot/m-p/188911#M6964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Code you used would help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Sep 2014 19:25:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Assigning-legend-labels-by-group-in-plot/m-p/188911#M6964</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-09-05T19:25:04Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning legend labels by group in plot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Assigning-legend-labels-by-group-in-plot/m-p/188912#M6965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Data would help too.&amp;nbsp; The GTL experts may be able to tell you what you need just by looking at your code but it always helps to have a complete working (or not working) program with data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Sep 2014 10:09:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Assigning-legend-labels-by-group-in-plot/m-p/188912#M6965</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2014-09-06T10:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning legend labels by group in plot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Assigning-legend-labels-by-group-in-plot/m-p/188913#M6966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The problem is that the plot reports back the group information to the legend, while your desired result is to have each series (without group) in the legend. There are some possible solutions, but I need to know the version of SAS you're using to give you the correct solution. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2014 13:27:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Assigning-legend-labels-by-group-in-plot/m-p/188913#M6966</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2014-09-09T13:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning legend labels by group in plot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Assigning-legend-labels-by-group-in-plot/m-p/188914#M6967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have done similar using BREAK option where I "spaghetti plot" subjects in normal range groups, Normal or High (with legend for range group), by adding an observation between each subject with missing values for the plot variables.&amp;nbsp; This makes a separate line for each subject with attributes of the normal range groups.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BREAK=&lt;SPAN class="userSuppliedValue" style="font-style: italic;"&gt;boolean&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="paraSimpleFirst"&gt;breaks the plot line at missing values of the X or Y variable.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2014 14:29:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Assigning-legend-labels-by-group-in-plot/m-p/188914#M6967</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2014-09-09T14:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning legend labels by group in plot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Assigning-legend-labels-by-group-in-plot/m-p/188915#M6968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you everyone for chiming in. Ultimately I found my answer in another post - &lt;A _jive_internal="true" href="https://communities.sas.com/message/141826#141826" title="https://communities.sas.com/message/141826#141826"&gt;https://communities.sas.com/message/141826#141826.&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Sep 2014 06:22:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Assigning-legend-labels-by-group-in-plot/m-p/188915#M6968</guid>
      <dc:creator>JohnPura</dc:creator>
      <dc:date>2014-09-11T06:22:42Z</dc:date>
    </item>
  </channel>
</rss>

