<?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 SGpanel different style attributes for different groups of the same variable in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SGpanel-different-style-attributes-for-different-groups-of-the/m-p/840277#M41560</link>
    <description>&lt;P&gt;Hello everybody,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My first time asking a question in this forum,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a couple of figures made in Excel that I try to move to SAS EG for more automatic handling.&lt;/P&gt;&lt;P&gt;Unfortunately I got stuck on a couple of figures. What they has In common is that they use the same numeric variable across different groups. &amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want is to use the same variable twice over different groups each with different attributes such as color and marker symbol.&lt;/P&gt;&lt;P&gt;This is what I want (From Excel):&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="JJ25_0-1666617985292.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76489i068AE188607B11E2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JJ25_0-1666617985292.png" alt="JJ25_0-1666617985292.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;My initial Dataset looks like this.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JJ25_1-1666618005552.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76490iE9587655CE294858/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JJ25_1-1666618005552.png" alt="JJ25_1-1666618005552.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I want to plot the Avg and Rek variables over the Sek variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For this I try to use SGPanel, “panel by” Sek and two series Avg and Rek. I use an Attributemap where the Sek variable as the value&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="JJ25_2-1666618066988.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76491iFBE1E95B0A8A6AA0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JJ25_2-1666618066988.png" alt="JJ25_2-1666618066988.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I tried many different approaches. The closest I get is when I make a copy of the Sek variable (Sek2) since only one Attrid can be assigned to variable.&lt;/P&gt;&lt;P&gt;More over I created an additional grouping variable GroupAvg or GroupRek so I can group on this variable and use the Sek variables to control the attributes. This gives the names in the legend correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc sgpanel data=omsattnig2 dattrmap=MyAttrMap;
	panelby sek / noborder nowall noheaderborder spacing=50 
 headerbackcolor=white headerattrs=(family=Arial size=16pt) novarname   
		headerbackcolor=white headerattrs=(family=Arial size=16pt) novarname;

series  X=year y=Avg / markers markerattrs=(size=15) lineattrs=(thickness= 4)
		group=GroupAvg grouplc=sek lcattrid=myregavg groupmc=sek mcattrid=myregavg groupms=sek msattrid=myregavg;

series  X=year y=Rek / markers markerattrs=(size=15) lineattrs=(thickness = 4)
		group=GroupRek grouplc=sek2 lcattrid=myregrek groupmc=sek2 mcattrid=myregrek groupms=sek2 msattrid=myregrek;
		
	rowaxis display=(nolabel noticks) valueattrs=(family=Arial size=12pt /*weight=bold*/) values=(0 to 14 by 2) 
		grid gridattrs=(thickness=2) offsetmin=0 offsetmax=0;
	colaxis display=(nolabel noticks) valueattrs=(family=Arial size=12pt /*weight=bold*/) 
		fitpolicy=rotate valuesrotate=vertical offsetmin=0;

	

		keylegend /  title='' noborder position=top  valueattrs=(size=12pt) autoitemsize across=4  ;
	format Avg Rek SPf.;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only remaining problem is that The legend only showing one of the attribute sets.&lt;/P&gt;&lt;P&gt;Probably because this is the same variable and this is the last one&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JJ25_0-1666618188885.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76493iBAD9AAFF3ABD752C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JJ25_0-1666618188885.png" alt="JJ25_0-1666618188885.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe I misunderstood or overcomplicate things but I really starting to get out of ideas. Hope I made myself clear, a little hard to explain. Any help is appreciated.&lt;/P&gt;&lt;P&gt;I’m on version 7.15 of EG&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards!&lt;/P&gt;</description>
    <pubDate>Mon, 24 Oct 2022 13:37:07 GMT</pubDate>
    <dc:creator>JJ25</dc:creator>
    <dc:date>2022-10-24T13:37:07Z</dc:date>
    <item>
      <title>SGpanel different style attributes for different groups of the same variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SGpanel-different-style-attributes-for-different-groups-of-the/m-p/840277#M41560</link>
      <description>&lt;P&gt;Hello everybody,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My first time asking a question in this forum,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a couple of figures made in Excel that I try to move to SAS EG for more automatic handling.&lt;/P&gt;&lt;P&gt;Unfortunately I got stuck on a couple of figures. What they has In common is that they use the same numeric variable across different groups. &amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want is to use the same variable twice over different groups each with different attributes such as color and marker symbol.&lt;/P&gt;&lt;P&gt;This is what I want (From Excel):&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="JJ25_0-1666617985292.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76489i068AE188607B11E2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JJ25_0-1666617985292.png" alt="JJ25_0-1666617985292.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;My initial Dataset looks like this.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JJ25_1-1666618005552.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76490iE9587655CE294858/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JJ25_1-1666618005552.png" alt="JJ25_1-1666618005552.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I want to plot the Avg and Rek variables over the Sek variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For this I try to use SGPanel, “panel by” Sek and two series Avg and Rek. I use an Attributemap where the Sek variable as the value&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="JJ25_2-1666618066988.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76491iFBE1E95B0A8A6AA0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JJ25_2-1666618066988.png" alt="JJ25_2-1666618066988.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I tried many different approaches. The closest I get is when I make a copy of the Sek variable (Sek2) since only one Attrid can be assigned to variable.&lt;/P&gt;&lt;P&gt;More over I created an additional grouping variable GroupAvg or GroupRek so I can group on this variable and use the Sek variables to control the attributes. This gives the names in the legend correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc sgpanel data=omsattnig2 dattrmap=MyAttrMap;
	panelby sek / noborder nowall noheaderborder spacing=50 
 headerbackcolor=white headerattrs=(family=Arial size=16pt) novarname   
		headerbackcolor=white headerattrs=(family=Arial size=16pt) novarname;

series  X=year y=Avg / markers markerattrs=(size=15) lineattrs=(thickness= 4)
		group=GroupAvg grouplc=sek lcattrid=myregavg groupmc=sek mcattrid=myregavg groupms=sek msattrid=myregavg;

series  X=year y=Rek / markers markerattrs=(size=15) lineattrs=(thickness = 4)
		group=GroupRek grouplc=sek2 lcattrid=myregrek groupmc=sek2 mcattrid=myregrek groupms=sek2 msattrid=myregrek;
		
	rowaxis display=(nolabel noticks) valueattrs=(family=Arial size=12pt /*weight=bold*/) values=(0 to 14 by 2) 
		grid gridattrs=(thickness=2) offsetmin=0 offsetmax=0;
	colaxis display=(nolabel noticks) valueattrs=(family=Arial size=12pt /*weight=bold*/) 
		fitpolicy=rotate valuesrotate=vertical offsetmin=0;

	

		keylegend /  title='' noborder position=top  valueattrs=(size=12pt) autoitemsize across=4  ;
	format Avg Rek SPf.;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only remaining problem is that The legend only showing one of the attribute sets.&lt;/P&gt;&lt;P&gt;Probably because this is the same variable and this is the last one&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JJ25_0-1666618188885.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76493iBAD9AAFF3ABD752C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JJ25_0-1666618188885.png" alt="JJ25_0-1666618188885.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe I misunderstood or overcomplicate things but I really starting to get out of ideas. Hope I made myself clear, a little hard to explain. Any help is appreciated.&lt;/P&gt;&lt;P&gt;I’m on version 7.15 of EG&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards!&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2022 13:37:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SGpanel-different-style-attributes-for-different-groups-of-the/m-p/840277#M41560</guid>
      <dc:creator>JJ25</dc:creator>
      <dc:date>2022-10-24T13:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: SGpanel different style attributes for different groups of the same variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SGpanel-different-style-attributes-for-different-groups-of-the/m-p/840319#M41561</link>
      <description>You can use NOAUTOLEGEND in the PROC SGPANEL statement and then define separate legends with two KEYLEGEND statements in your code.Note you need to provide a label for each legend item that you define in the SERIES statement and then provide attributes for in the KEYLEGEND statement.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatproc/n1txerz2g23a70n1kqo75gs8srla.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatproc/n1txerz2g23a70n1kqo75gs8srla.htm&lt;/A&gt;</description>
      <pubDate>Mon, 24 Oct 2022 15:54:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SGpanel-different-style-attributes-for-different-groups-of-the/m-p/840319#M41561</guid>
      <dc:creator>svh</dc:creator>
      <dc:date>2022-10-24T15:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: SGpanel different style attributes for different groups of the same variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SGpanel-different-style-attributes-for-different-groups-of-the/m-p/840493#M41564</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* You could make two variables for avg and rek */
data have;
call streaminit(123);
do sek='K', 'R';
  do year=2011 to 2021;
    avg=rand('uniform');
 rek=0.1+rand('uniform');
 output;
  end;
end;
format avg rek percent8.2;
run;
data have2;
 set have;
 if sek='R' then do;avg2=avg;rek2=rek;call missing(avg,rek);end;
run;

proc sgpanel data=have2;
panelby sek /noborder nowall noheaderborder spacing=50  headerbackcolor=white  novarname  layout=panel ;
series  X=year y=Avg / markers markerattrs=(size=15 symbol=circlefilled color=brown) lineattrs=(thickness=4 color=brown)  legendlabel='Avg';
series  X=year y=rek / markers markerattrs=(size=15 symbol=circlefilled color=orange) lineattrs=(thickness=4 color=orange) legendlabel='Rek';
series  X=year y=Avg2 / markers markerattrs=(size=15 symbol=circlefilled color=navy) lineattrs=(thickness=4 color=navy) legendlabel='Avg';
series  X=year y=rek2 / markers markerattrs=(size=15 symbol=circlefilled color=blue) lineattrs=(thickness=4 color=blue)legendlabel='Rek' ;
keylegend  /position=top noborder;
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-1666698735699.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76546i706BAEE20BE75107/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1666698735699.png" alt="Ksharp_0-1666698735699.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 11:51:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SGpanel-different-style-attributes-for-different-groups-of-the/m-p/840493#M41564</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-10-25T11:51:51Z</dc:date>
    </item>
  </channel>
</rss>

