<?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: How to SGPLOT with varied line colors?! in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-SGPLOT-with-varied-line-colors/m-p/974716#M377970</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _test;
do grp=1 to 6;
	do ind=1 to 100;
		yvalue=sin(ind/10)+grp;
		gx=grp;
		output;
	end;
end;
run;quit;



data dattrmap;
infile cards truncover;
input id $ value :$20. linecolor $  ;
datalines;
x  1  red 
x  2  blue 
x  3  green 
x  4  yellow 
x  5  purple 
x  6  black 
;
run;


	ods layout gridded columns=3 rows=2 advance=bygroup;
	proc sgplot data=_test noautolegend uniform=xscale dattrmap=dattrmap; 
	by grp;
	series x=ind y=yvalue / group=grp lineattrs=( thickness=2 pattern=solid) attrid=x  ;     
	refline  30/axis=x lineattrs=(color=red thickness=2 pattern=solid); 
	run;
	ods layout end;&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-1757487441470.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/109846i97702F9438CA1D48/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1757487441470.png" alt="Ksharp_0-1757487441470.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 10 Sep 2025 06:57:32 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2025-09-10T06:57:32Z</dc:date>
    <item>
      <title>How to SGPLOT with varied line colors?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-SGPLOT-with-varied-line-colors/m-p/974635#M377961</link>
      <description>&lt;P&gt;I need generate 3-by-2 plots, which the code below does. BUT also need let the lines are with varied colors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are GROUPLC= and&amp;nbsp;styleattrs datacontrastcolors=(red green black orange blue cyan);&amp;nbsp; BUT only for multiple lines within a single plot.&lt;/P&gt;
&lt;P&gt;How to get 3-by-2 plots with controlled/varied colors?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any other PROC is fine.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _test;
do grp=1 to 6;
	do ind=1 to 100;
		yvalue=sin(ind/10)+grp;
		gx=grp;
		output;
	end;
end;
run;quit;

	ods layout gridded columns=3 rows=2 advance=bygroup;
	proc sgplot data=_test noautolegend uniform=xscale; 
	by grp;
	series x=ind y=yvalue / group=grp lineattrs=( thickness=2 pattern=solid) grouplc=grp ;     
	refline  30/axis=x lineattrs=(color=red thickness=2 pattern=solid); 
	run;
	ods layout end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Sep 2025 15:15:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-SGPLOT-with-varied-line-colors/m-p/974635#M377961</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2025-09-09T15:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to SGPLOT with varied line colors?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-SGPLOT-with-varied-line-colors/m-p/974716#M377970</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _test;
do grp=1 to 6;
	do ind=1 to 100;
		yvalue=sin(ind/10)+grp;
		gx=grp;
		output;
	end;
end;
run;quit;



data dattrmap;
infile cards truncover;
input id $ value :$20. linecolor $  ;
datalines;
x  1  red 
x  2  blue 
x  3  green 
x  4  yellow 
x  5  purple 
x  6  black 
;
run;


	ods layout gridded columns=3 rows=2 advance=bygroup;
	proc sgplot data=_test noautolegend uniform=xscale dattrmap=dattrmap; 
	by grp;
	series x=ind y=yvalue / group=grp lineattrs=( thickness=2 pattern=solid) attrid=x  ;     
	refline  30/axis=x lineattrs=(color=red thickness=2 pattern=solid); 
	run;
	ods layout end;&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-1757487441470.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/109846i97702F9438CA1D48/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1757487441470.png" alt="Ksharp_0-1757487441470.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Sep 2025 06:57:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-SGPLOT-with-varied-line-colors/m-p/974716#M377970</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-09-10T06:57:32Z</dc:date>
    </item>
  </channel>
</rss>

