<?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 How to select user colours with the group option in proc sgplot in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-user-colours-with-the-group-option-in-proc-sgplot/m-p/951309#M371897</link>
    <description>&lt;P&gt;Hi All&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I am trying to draw graphs using the proc sgplot with the group option. SAS provides me with automatic colours and I need to choose my own preferred colours. the program I use is as below and data attached.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;proc sgplot data=Tested3;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; vline Dates / response=Amount group=sampling_point groupdisplay=overlay ;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;yaxis values=(0 to 3000 by 30000) label='Free Chlorine' grid LABELATTRS=(weight=bold family=Helvetica size=7)&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; VALUEATTRS=(family=Helvetica size=7 style=normal weight=normal ) ;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;refline 9500 / axis=y label=('9500 expected') lineattrs=(color=red pattern=dash) labelattrs=(size=7) labelloc=inside;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; xaxis interval=day VALUESROTATE=VERTICAL label='Sampled dates' LABELATTRS=(weight=bold size=7) valuesrotate=vertical &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;VALUEATTRS=(family=arial size=10 style=normal weight=normal ) type=time;&lt;/DIV&gt;
&lt;DIV&gt;title1 j=c "Expenditure trend" bold;&lt;/DIV&gt;
&lt;DIV&gt;run;&lt;/DIV&gt;</description>
    <pubDate>Wed, 20 Nov 2024 12:03:43 GMT</pubDate>
    <dc:creator>mmohotsi</dc:creator>
    <dc:date>2024-11-20T12:03:43Z</dc:date>
    <item>
      <title>How to select user colours with the group option in proc sgplot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-user-colours-with-the-group-option-in-proc-sgplot/m-p/951309#M371897</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I am trying to draw graphs using the proc sgplot with the group option. SAS provides me with automatic colours and I need to choose my own preferred colours. the program I use is as below and data attached.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;proc sgplot data=Tested3;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; vline Dates / response=Amount group=sampling_point groupdisplay=overlay ;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;yaxis values=(0 to 3000 by 30000) label='Free Chlorine' grid LABELATTRS=(weight=bold family=Helvetica size=7)&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; VALUEATTRS=(family=Helvetica size=7 style=normal weight=normal ) ;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;refline 9500 / axis=y label=('9500 expected') lineattrs=(color=red pattern=dash) labelattrs=(size=7) labelloc=inside;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; xaxis interval=day VALUESROTATE=VERTICAL label='Sampled dates' LABELATTRS=(weight=bold size=7) valuesrotate=vertical &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;VALUEATTRS=(family=arial size=10 style=normal weight=normal ) type=time;&lt;/DIV&gt;
&lt;DIV&gt;title1 j=c "Expenditure trend" bold;&lt;/DIV&gt;
&lt;DIV&gt;run;&lt;/DIV&gt;</description>
      <pubDate>Wed, 20 Nov 2024 12:03:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-user-colours-with-the-group-option-in-proc-sgplot/m-p/951309#M371897</guid>
      <dc:creator>mmohotsi</dc:creator>
      <dc:date>2024-11-20T12:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to select user colours with the group option in proc sgplot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-user-colours-with-the-group-option-in-proc-sgplot/m-p/951317#M371898</link>
      <description>&lt;P&gt;For which elements of your graph do you want to specify colors?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 12:19:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-user-colours-with-the-group-option-in-proc-sgplot/m-p/951317#M371898</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2024-11-20T12:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to select user colours with the group option in proc sgplot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-user-colours-with-the-group-option-in-proc-sgplot/m-p/951320#M371900</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/77934"&gt;@mmohotsi&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A simple solution is to add a STYLEATTRS statement to the PROC SGPLOT step and to specify the group colors in the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatproc/p1dt33l6a6epk6n1chtynsgsjgit.htm#n127g3inn11zr9n0zbbeack0ql9h" target="_blank" rel="noopener"&gt;DATACONTRASTCOLORS= option&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;FONT color="#999999"&gt;proc sgplot data=Tested3;&lt;/FONT&gt;
&lt;STRONG&gt;  styleattrs datacontrastcolors=(lime gray purple skyblue);&lt;/STRONG&gt;
&lt;FONT color="#999999"&gt;  vline Dates / response=Amount group=sampling_point groupdisplay=overlay ;
...&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;See&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatproc/p0edl20cvxxmm9n1i9ht3n21eict.htm" target="_blank" rel="noopener"&gt;Color-Naming Schemes&lt;/A&gt; for the various ways to specify colors (e.g., by RGB values).&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 12:36:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-user-colours-with-the-group-option-in-proc-sgplot/m-p/951320#M371900</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-11-20T12:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to select user colours with the group option in proc sgplot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-user-colours-with-the-group-option-in-proc-sgplot/m-p/951348#M371904</link>
      <description>&lt;P&gt;If you want graphs to display the same properties, colors, markers, line types for example based on the VALUE of a group variable then you likely want to investigate the use of DATTRMAP= helper data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Other approaches using the same style lists can display the same value with different colors based on the order of the data.&lt;/P&gt;
&lt;P&gt;Here is an example to demonstrate the order of values encountered can affect the color usage:&lt;/P&gt;
&lt;PRE&gt;data work.class;
   set sashelp.class;
run;

proc sort data=work.class;
   by sex;
run;

proc sgplot data=work.class;
   title "Sorted by Sex";
   styleattrs datacontrastcolors=(Red blue);
   scatter x=height y=weight/group=sex;
run;title;

proc sort data=work.class;
   by descending sex;
run;

proc sgplot data=work.class;
   title "Sorted by descending Sex";
   styleattrs datacontrastcolors=(Red blue);
   scatter x=height y=weight/group=sex;
run;title;

&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/77934"&gt;@mmohotsi&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi All&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I am trying to draw graphs using the proc sgplot with the group option. SAS provides me with automatic colours and I need to choose my own preferred colours. the program I use is as below and data attached.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;proc sgplot data=Tested3;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; vline Dates / response=Amount group=sampling_point groupdisplay=overlay ;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;yaxis values=(0 to 3000 by 30000) label='Free Chlorine' grid LABELATTRS=(weight=bold family=Helvetica size=7)&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; VALUEATTRS=(family=Helvetica size=7 style=normal weight=normal ) ;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;refline 9500 / axis=y label=('9500 expected') lineattrs=(color=red pattern=dash) labelattrs=(size=7) labelloc=inside;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; xaxis interval=day VALUESROTATE=VERTICAL label='Sampled dates' LABELATTRS=(weight=bold size=7) valuesrotate=vertical &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;VALUEATTRS=(family=arial size=10 style=normal weight=normal ) type=time;&lt;/DIV&gt;
&lt;DIV&gt;title1 j=c "Expenditure trend" bold;&lt;/DIV&gt;
&lt;DIV&gt;run;&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 17:55:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-user-colours-with-the-group-option-in-proc-sgplot/m-p/951348#M371904</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-11-20T17:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to select user colours with the group option in proc sgplot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-user-colours-with-the-group-option-in-proc-sgplot/m-p/951435#M371935</link>
      <description>Good morning&lt;BR /&gt;&lt;BR /&gt;I wish to draw trend line for amount and group by sampling_point with Dates on the horizontal axis&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Nov 2024 05:57:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-user-colours-with-the-group-option-in-proc-sgplot/m-p/951435#M371935</guid>
      <dc:creator>mmohotsi</dc:creator>
      <dc:date>2024-11-21T05:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to select user colours with the group option in proc sgplot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-user-colours-with-the-group-option-in-proc-sgplot/m-p/951600#M371972</link>
      <description>Thank you FreelanceReinh (Jade | Level 19)&lt;BR /&gt;That's the solution to my problem&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 22 Nov 2024 07:04:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-user-colours-with-the-group-option-in-proc-sgplot/m-p/951600#M371972</guid>
      <dc:creator>mmohotsi</dc:creator>
      <dc:date>2024-11-22T07:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to select user colours with the group option in proc sgplot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-user-colours-with-the-group-option-in-proc-sgplot/m-p/951751#M372017</link>
      <description>&lt;P&gt;Good day&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Solution accepted&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks to you FreelanceReinh Jade&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Much appreciated&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2024 06:30:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-user-colours-with-the-group-option-in-proc-sgplot/m-p/951751#M372017</guid>
      <dc:creator>mmohotsi</dc:creator>
      <dc:date>2024-11-25T06:30:53Z</dc:date>
    </item>
  </channel>
</rss>

