<?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: Suggestions for SGPlot with groups and multiple series in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Suggestions-for-SGPlot-with-groups-and-multiple-series/m-p/925699#M46048</link>
    <description>Yes. Try read its DOC in support.sas.com</description>
    <pubDate>Thu, 25 Apr 2024 05:34:21 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2024-04-25T05:34:21Z</dc:date>
    <item>
      <title>Suggestions for SGPlot with groups and multiple series</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Suggestions-for-SGPlot-with-groups-and-multiple-series/m-p/925487#M46018</link>
      <description>&lt;P&gt;Anyone have suggestions for simple ways to present this sort of data: multiple series with groups. The following codes doesn't work, the legend only has information for the groups in the first series. If I can't get both the series and groups in the legend, I'd like to have the series in the legend with a consistent formatting for the groups (eg group B always dotted lines).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data temp;
input x grp $ s1 s2 s3;
cards;
1 A 1 1 1
2 A 2 3 4
3 A 1 2 3
1 B 1.2 1.2 1.2
2 B 2.2 3.2 4.2
3 B 1.2 2.2 3.2
;
run;

proc sgplot data=temp;
series x=x y=s1 /markers group=grp ;
series x=x y=s2 /markers group=grp ;
series x=x y=s3 /markers group=grp ;
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Apr 2024 03:01:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Suggestions-for-SGPlot-with-groups-and-multiple-series/m-p/925487#M46018</guid>
      <dc:creator>BruceBrad</dc:creator>
      <dc:date>2024-04-24T03:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: Suggestions for SGPlot with groups and multiple series</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Suggestions-for-SGPlot-with-groups-and-multiple-series/m-p/925497#M46021</link>
      <description>&lt;P&gt;You want this ?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp;
input x grp $ s1 s2 s3;
cards;
1 A 1 1 1
2 A 2 3 4
3 A 1 2 3
1 B 1.2 1.2 1.2
2 B 2.2 3.2 4.2
3 B 1.2 2.2 3.2
;
run;

proc sgplot data=temp;
series x=x y=s1 /markers group=grp name='a' ;
series x=x y=s2 /markers group=grp name='b';
series x=x y=s3 /markers group=grp name='c';
keylegend 'a' 'b' 'c';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1713938930909.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/95799i8424E0803CCEE5F5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1713938930909.png" alt="Ksharp_0-1713938930909.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;Or this one ?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods graphics/attrpriority=none;
proc sgplot data=temp;
series x=x y=s1 /markers group=grp name='a' ;
series x=x y=s2 /markers group=grp name='b';
series x=x y=s3 /markers group=grp name='c';
keylegend 'a' 'b' 'c';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_1-1713939001872.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/95800i2EE7967278FF90A9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_1-1713939001872.png" alt="Ksharp_1-1713939001872.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2024 06:10:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Suggestions-for-SGPlot-with-groups-and-multiple-series/m-p/925497#M46021</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-04-24T06:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: Suggestions for SGPlot with groups and multiple series</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Suggestions-for-SGPlot-with-groups-and-multiple-series/m-p/925504#M46022</link>
      <description>Thanks. I see now how to get all lines in the legend. But I need some way to indicate both the series and the group. Eg three different colours (or markers) for the series, and two different patterns for the groups (eg A=solid, B=dotted).</description>
      <pubDate>Wed, 24 Apr 2024 06:24:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Suggestions-for-SGPlot-with-groups-and-multiple-series/m-p/925504#M46022</guid>
      <dc:creator>BruceBrad</dc:creator>
      <dc:date>2024-04-24T06:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: Suggestions for SGPlot with groups and multiple series</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Suggestions-for-SGPlot-with-groups-and-multiple-series/m-p/925516#M46023</link>
      <description>&lt;P&gt;Then you need to change your data structure by proc transpose.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp;
input x grp $ s1 s2 s3;
cards;
1 A 1 1 1
2 A 2 3 4
3 A 1 2 3
1 B 1.2 1.2 1.2
2 B 2.2 3.2 4.2
3 B 1.2 2.2 3.2
;
run;

proc sort data=temp;by grp x;run;
proc transpose data=temp out=temp2;
by grp x;
var s:;
run;
proc sort data=temp2 out=temp3;by _name_ grp x;run;
data temp4;
 set temp3;
 group=cats(_name_,grp);
run;
proc sgplot data=temp4;
series x=x y=col1/markers group=group grouplc=_name_ grouplp=grp groupms=_name_ groupmc=_name_;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1713951726601.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/95807i3A2676F153F16495/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1713951726601.png" alt="Ksharp_0-1713951726601.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>Wed, 24 Apr 2024 09:42:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Suggestions-for-SGPlot-with-groups-and-multiple-series/m-p/925516#M46023</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-04-24T09:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: Suggestions for SGPlot with groups and multiple series</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Suggestions-for-SGPlot-with-groups-and-multiple-series/m-p/925575#M46024</link>
      <description>&lt;P&gt;Another option might be to move to SGPANEL and display each series in a different graph:&lt;/P&gt;
&lt;P&gt;Using the data set Temp3 as created by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sgpanel data=temp3;
   panelby _name_;
   series x=x y=col1/markers group=grp ;
   label _name_ ='Series';
run;&lt;/PRE&gt;
&lt;P&gt;If each series were to have more than 2 values for Grp, or if values are very similar or more complex it might be hard to tell things apart based just on the line style attributes. Using options in Sgpanel to produce on column of graphs would place them one over another for possibly easier interpretation.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2024 14:29:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Suggestions-for-SGPlot-with-groups-and-multiple-series/m-p/925575#M46024</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-04-24T14:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: Suggestions for SGPlot with groups and multiple series</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Suggestions-for-SGPlot-with-groups-and-multiple-series/m-p/925684#M46045</link>
      <description>Great. So, summarising:&lt;BR /&gt;- Reshape the data to use one series with groups (and use the 9.4m2+ options to control the group colours and patterns).&lt;BR /&gt;- I guess reshaping the data and using multiple series without groups would also work (but not as elegant).&lt;BR /&gt;Thanks.</description>
      <pubDate>Thu, 25 Apr 2024 02:54:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Suggestions-for-SGPlot-with-groups-and-multiple-series/m-p/925684#M46045</guid>
      <dc:creator>BruceBrad</dc:creator>
      <dc:date>2024-04-25T02:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: Suggestions for SGPlot with groups and multiple series</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Suggestions-for-SGPlot-with-groups-and-multiple-series/m-p/925687#M46046</link>
      <description>&lt;P&gt;Yes. You are right. The following code is more simple than the post of mine above (GROUPLC= option make me to complcate the code).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp;
input x grp $ s1 s2 s3;
cards;
1 A 1 1 1
2 A 2 3 4
3 A 1 2 3
1 B 1.2 1.2 1.2
2 B 2.2 3.2 4.2
3 B 1.2 2.2 3.2
;
run;

ods graphics/attrpriority=none;
proc sgplot data=temp nocycleattrs;
series x=x y=s1 /markers group=grp lineattrs=(color=green) markerattrs=(symbol=plus);
series x=x y=s2 /markers group=grp lineattrs=(color=red) markerattrs=(symbol=circle);
series x=x y=s3 /markers group=grp lineattrs=(color=blue) markerattrs=(symbol=X);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1714014742723.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/95846i8E0B9231AC60F1D3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1714014742723.png" alt="Ksharp_0-1714014742723.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2024 03:12:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Suggestions-for-SGPlot-with-groups-and-multiple-series/m-p/925687#M46046</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-04-25T03:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: Suggestions for SGPlot with groups and multiple series</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Suggestions-for-SGPlot-with-groups-and-multiple-series/m-p/925691#M46047</link>
      <description>I'm not sure this is simple! It means I have to understand the interaction between attrpriority and cycleattrs. Even after reading &lt;A href="https://blogs.sas.com/content/iml/2018/06/13/attrpriority-cycleattrs-styleattrs-ods-graphics.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2018/06/13/attrpriority-cycleattrs-styleattrs-ods-graphics.html&lt;/A&gt; this seems very messy.</description>
      <pubDate>Thu, 25 Apr 2024 03:49:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Suggestions-for-SGPlot-with-groups-and-multiple-series/m-p/925691#M46047</guid>
      <dc:creator>BruceBrad</dc:creator>
      <dc:date>2024-04-25T03:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: Suggestions for SGPlot with groups and multiple series</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Suggestions-for-SGPlot-with-groups-and-multiple-series/m-p/925699#M46048</link>
      <description>Yes. Try read its DOC in support.sas.com</description>
      <pubDate>Thu, 25 Apr 2024 05:34:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Suggestions-for-SGPlot-with-groups-and-multiple-series/m-p/925699#M46048</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-04-25T05:34:21Z</dc:date>
    </item>
  </channel>
</rss>

