<?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 SGPLOT-removing the red from the default random list of colors in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/PROC-SGPLOT-removing-the-red-from-the-default-random-list-of/m-p/551246#M8941</link>
    <description>&lt;P&gt;I stole some code from the blog post&amp;nbsp;&lt;A href="https://blogs.sas.com/content/iml/2017/02/06/group-colors-sgplot.html" target="_self"&gt;What colors does PROC SGPLOT use for markers?&lt;/A&gt;&amp;nbsp;that might help you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This lets you control the colors in the Styleattrs Statement dynamically. Here, I drag the red color out of the picture&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname temp "C:/temp";
proc template;
source styles.statistical / file='temp.tmp'; /* write template to text file */
quit;
 
data Colors;
keep Num Name Color R G B;
length Name Color $8;
infile 'temp.tmp';                    /* read from text file */
input;
/* example string:  'gcdata1' = cx445694 */
k = find(_infile_,'gcdata','i');      /* if k=0 then string not found */
if k &amp;gt; 0 then do;                     /* Found line that contains 'gcdata' */
   s = substr(_infile_, k);           /* substring from 'gcdata' to end of line */
   j = index(s, "'");                 /* index of closing quote  */
   Name = substr(s, 1, j-1);          /* keyword                 */
   if j = 7 then Num = 0;             /* string is 'gcdata'      */
   else                               /* extract number 1, 2, ... for strings */
      Num = inputn(substr(s, 7, j-7), "best2.");  /* gcdata1, gcdata2,...     */
   j = index(s, "=");                 /* index of equal sign     */
   Color = compress(substr(s, j+1));  /* color value for keyword */
   R = inputn(substr(Color, 3, 2), "HEX2.");   /* convert hex to RGB */
   G = inputn(substr(Color, 5, 2), "HEX2.");
   B = inputn(substr(Color, 7, 2), "HEX2.");
end;
if k &amp;gt; 0;
run;

proc sql noprint;
   select Color into :colorlist separated by ' '
   from Colors where Color ne 'cxA23A2E';
quit;

%put &amp;amp;colorlist.;

data A;
do Color = 1 to 20;
   x = Color; y = Color;  output;
end;
run;

proc sgplot data=A;
   *styleattrs Datacolors = (&amp;amp;colorlist.);
   vbar y / group=Color;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here is the result without the Styleattrs Statement&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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-left" image-alt="SGPlot25.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/28708i93752E335FB77051/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPlot25.png" alt="SGPlot25.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;P&gt;&amp;nbsp;&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;P&gt;&amp;nbsp;&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;P&gt;&amp;nbsp;&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;P&gt;&amp;nbsp;&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;P&gt;&amp;nbsp;&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;P&gt;And here it is without the red color&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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-left" image-alt="SGPlot24.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/28709iA2167713E1C11258/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPlot24.png" alt="SGPlot24.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 15 Apr 2019 20:23:26 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2019-04-15T20:23:26Z</dc:date>
    <item>
      <title>PROC SGPLOT-removing the red from the default random list of colors</title>
      <link>https://communities.sas.com/t5/New-SAS-User/PROC-SGPLOT-removing-the-red-from-the-default-random-list-of/m-p/551189#M8927</link>
      <description>&lt;P&gt;I dont want to use the color red from this random list of colors in the plot. How do I omit the red color from the plot?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 18:44:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/PROC-SGPLOT-removing-the-red-from-the-default-random-list-of/m-p/551189#M8927</guid>
      <dc:creator>JW_Hyde</dc:creator>
      <dc:date>2019-04-15T18:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT-removing the red from the default random list of colors</title>
      <link>https://communities.sas.com/t5/New-SAS-User/PROC-SGPLOT-removing-the-red-from-the-default-random-list-of/m-p/551191#M8929</link>
      <description>&lt;P&gt;Please show us your code if you want a usable code answer &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 18:46:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/PROC-SGPLOT-removing-the-red-from-the-default-random-list-of/m-p/551191#M8929</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-04-15T18:46:36Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT-removing the red from the default random list of colors</title>
      <link>https://communities.sas.com/t5/New-SAS-User/PROC-SGPLOT-removing-the-red-from-the-default-random-list-of/m-p/551195#M8932</link>
      <description>ods html close;&lt;BR /&gt;ods listing close;&lt;BR /&gt;ods graphics / imagemap=on imagename="&amp;amp;imgcht1"&lt;BR /&gt;height=750px width=1200px&lt;BR /&gt;tipmax=1600 antialiasmax=1600;&lt;BR /&gt;&lt;BR /&gt;ods html path=grf1 body="&amp;amp;tagcht1" ;&lt;BR /&gt;&lt;BR /&gt;proc sgplot data=acctout;&lt;BR /&gt;yaxis&lt;BR /&gt;labelattrs=(size=8 color=black)&lt;BR /&gt;LABEL= '# of Requests'&lt;BR /&gt;refticks&lt;BR /&gt;min=0&lt;BR /&gt;valueattrs=(size=8 color=black )&lt;BR /&gt;;&lt;BR /&gt;xaxis&lt;BR /&gt;fitpolicy= rotatethin&lt;BR /&gt;labelattrs=(size=8 color=black)&lt;BR /&gt;;&lt;BR /&gt;title1 h=1.5 c=black j=c f=swissb&lt;BR /&gt;'PROD';&lt;BR /&gt;title2 h=1.0 c=gray j=c f=swissb&lt;BR /&gt;"Reported Day = &amp;amp;EDTT";&lt;BR /&gt;title3 h=1.0 c=gray j=c f=swissb&lt;BR /&gt;"By appname";&lt;BR /&gt;&lt;BR /&gt;vbar date/response=req&lt;BR /&gt;group=appname dataskin=gloss;&lt;BR /&gt;&lt;BR /&gt;run ;&lt;BR /&gt;</description>
      <pubDate>Mon, 15 Apr 2019 18:52:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/PROC-SGPLOT-removing-the-red-from-the-default-random-list-of/m-p/551195#M8932</guid>
      <dc:creator>JW_Hyde</dc:creator>
      <dc:date>2019-04-15T18:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT-removing the red from the default random list of colors</title>
      <link>https://communities.sas.com/t5/New-SAS-User/PROC-SGPLOT-removing-the-red-from-the-default-random-list-of/m-p/551210#M8935</link>
      <description>&lt;P&gt;In general, I am a believer in controlling the colors yourself, rather than let SAS do it for you. Thus, you could use the STYLEATTRS command in PROC SGPLOT, specifying the DATACOLORS= option and then you get whatever colors you want.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 19:17:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/PROC-SGPLOT-removing-the-red-from-the-default-random-list-of/m-p/551210#M8935</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-04-15T19:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT-removing the red from the default random list of colors</title>
      <link>https://communities.sas.com/t5/New-SAS-User/PROC-SGPLOT-removing-the-red-from-the-default-random-list-of/m-p/551218#M8938</link>
      <description>I would do that but I have a couple dozen categories and maybe more on the way.&lt;BR /&gt;That's a bit of a maintenance headache.&lt;BR /&gt;</description>
      <pubDate>Mon, 15 Apr 2019 19:38:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/PROC-SGPLOT-removing-the-red-from-the-default-random-list-of/m-p/551218#M8938</guid>
      <dc:creator>JW_Hyde</dc:creator>
      <dc:date>2019-04-15T19:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT-removing the red from the default random list of colors</title>
      <link>https://communities.sas.com/t5/New-SAS-User/PROC-SGPLOT-removing-the-red-from-the-default-random-list-of/m-p/551246#M8941</link>
      <description>&lt;P&gt;I stole some code from the blog post&amp;nbsp;&lt;A href="https://blogs.sas.com/content/iml/2017/02/06/group-colors-sgplot.html" target="_self"&gt;What colors does PROC SGPLOT use for markers?&lt;/A&gt;&amp;nbsp;that might help you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This lets you control the colors in the Styleattrs Statement dynamically. Here, I drag the red color out of the picture&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname temp "C:/temp";
proc template;
source styles.statistical / file='temp.tmp'; /* write template to text file */
quit;
 
data Colors;
keep Num Name Color R G B;
length Name Color $8;
infile 'temp.tmp';                    /* read from text file */
input;
/* example string:  'gcdata1' = cx445694 */
k = find(_infile_,'gcdata','i');      /* if k=0 then string not found */
if k &amp;gt; 0 then do;                     /* Found line that contains 'gcdata' */
   s = substr(_infile_, k);           /* substring from 'gcdata' to end of line */
   j = index(s, "'");                 /* index of closing quote  */
   Name = substr(s, 1, j-1);          /* keyword                 */
   if j = 7 then Num = 0;             /* string is 'gcdata'      */
   else                               /* extract number 1, 2, ... for strings */
      Num = inputn(substr(s, 7, j-7), "best2.");  /* gcdata1, gcdata2,...     */
   j = index(s, "=");                 /* index of equal sign     */
   Color = compress(substr(s, j+1));  /* color value for keyword */
   R = inputn(substr(Color, 3, 2), "HEX2.");   /* convert hex to RGB */
   G = inputn(substr(Color, 5, 2), "HEX2.");
   B = inputn(substr(Color, 7, 2), "HEX2.");
end;
if k &amp;gt; 0;
run;

proc sql noprint;
   select Color into :colorlist separated by ' '
   from Colors where Color ne 'cxA23A2E';
quit;

%put &amp;amp;colorlist.;

data A;
do Color = 1 to 20;
   x = Color; y = Color;  output;
end;
run;

proc sgplot data=A;
   *styleattrs Datacolors = (&amp;amp;colorlist.);
   vbar y / group=Color;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here is the result without the Styleattrs Statement&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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-left" image-alt="SGPlot25.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/28708i93752E335FB77051/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPlot25.png" alt="SGPlot25.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;P&gt;&amp;nbsp;&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;P&gt;&amp;nbsp;&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;P&gt;&amp;nbsp;&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;P&gt;&amp;nbsp;&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;P&gt;&amp;nbsp;&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;P&gt;And here it is without the red color&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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-left" image-alt="SGPlot24.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/28709iA2167713E1C11258/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPlot24.png" alt="SGPlot24.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 20:23:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/PROC-SGPLOT-removing-the-red-from-the-default-random-list-of/m-p/551246#M8941</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-04-15T20:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT-removing the red from the default random list of colors</title>
      <link>https://communities.sas.com/t5/New-SAS-User/PROC-SGPLOT-removing-the-red-from-the-default-random-list-of/m-p/551415#M8973</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/139214"&gt;@JW_Hyde&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I dont want to use the color red from this random list of colors in the plot. How do I omit the red color from the plot?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Unless you are writing code to explicitly make a random set of colors SAS does not use a "random list of colors". The first color used for the first graph element displayed&amp;nbsp;will be the color defined in the current style for graphcolor1 and/contrast, the second item with graphcolor2 and so on through 12 with typical SAS defined styles. Then an algorithm creates others or reuses depending on options.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 15:29:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/PROC-SGPLOT-removing-the-red-from-the-default-random-list-of/m-p/551415#M8973</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-04-16T15:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT-removing the red from the default random list of colors</title>
      <link>https://communities.sas.com/t5/New-SAS-User/PROC-SGPLOT-removing-the-red-from-the-default-random-list-of/m-p/552430#M9190</link>
      <description>&lt;P&gt;In the end this was the solution I chose. I had to define a color list for 3 dozen colors but I did get something that was more presentable. Just make sure that the color BLUE is not the first color in your list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks all.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Apr 2019 13:21:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/PROC-SGPLOT-removing-the-red-from-the-default-random-list-of/m-p/552430#M9190</guid>
      <dc:creator>JW_Hyde</dc:creator>
      <dc:date>2019-04-19T13:21:45Z</dc:date>
    </item>
  </channel>
</rss>

