<?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: Assigning colors and patterns to each category of a variable in sgplot in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-and-patterns-to-each-category-of-a-variable-in/m-p/889595#M39538</link>
    <description>Thank you so much.&lt;BR /&gt;Both options work. I tried both and found that the datacontrastcolors gives less control compared to the other one.&lt;BR /&gt;Best Regards&lt;BR /&gt;</description>
    <pubDate>Thu, 17 Aug 2023 08:12:37 GMT</pubDate>
    <dc:creator>Novice_</dc:creator>
    <dc:date>2023-08-17T08:12:37Z</dc:date>
    <item>
      <title>Assigning colors and patterns to each category of a variable in sgplot</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-and-patterns-to-each-category-of-a-variable-in/m-p/889307#M39507</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ods graphics on;&lt;BR /&gt;proc sgplot data=numbers noautolegend;&lt;BR /&gt;series x=time y=rate / group=group_cat;&lt;BR /&gt;keylegend / title='Group Categories' position=right;&lt;BR /&gt;xaxis grid label="Week";&lt;BR /&gt;yaxis grid;&lt;BR /&gt;run;&lt;BR /&gt;ods graphics off;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and the plot I get is below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PLOT.JPG" style="width: 645px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/86729iE2409EF1A9CBB17B/image-size/large?v=v2&amp;amp;px=999" role="button" title="PLOT.JPG" alt="PLOT.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I need help with changing the patterns, thickness and colors of each line in this plot. The variable group_cat has 4 categories. I&lt;SPAN&gt;s it possible to do it within this code or do I need to create 4 variables representing the 4 categories and add 4 series statements? Thank you.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2023 08:57:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-and-patterns-to-each-category-of-a-variable-in/m-p/889307#M39507</guid>
      <dc:creator>Novice_</dc:creator>
      <dc:date>2023-08-15T08:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning colors and patterns to each category of a variable in sgplot</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-and-patterns-to-each-category-of-a-variable-in/m-p/889308#M39508</link>
      <description>&lt;P&gt;You can use the STYLEATTRS command with the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/grstatproc/p1dt33l6a6epk6n1chtynsgsjgit.htm#n127g3inn11zr9n0zbbeack0ql9h" target="_self"&gt;DATACONTRASTCOLORS= option&lt;/A&gt; in PROC SGPLOT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you can also assign colors via a discrete attribute map: &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/grstatproc/n18szqcwir8q2nn10od9hhdh2ksj.htm" target="_blank" rel="noopener"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/grstatproc/n18szqcwir8q2nn10od9hhdh2ksj.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2023 09:19:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-and-patterns-to-each-category-of-a-variable-in/m-p/889308#M39508</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-08-15T09:19:59Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning colors and patterns to each category of a variable in sgplot</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-and-patterns-to-each-category-of-a-variable-in/m-p/889326#M39510</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data dattrmap;
retain ID "myid";
input value :$20. linethickness  linecolor $ linepattern $;
datalines;
IBM    2  orange  solid
Intel    4    blue    dot
Microsoft  8    red    longdash
;
run;


proc sgplot data=sashelp.stocks dattrmap=dattrmap;
where date between '01JAN02'd and '30DEC02'd;
series x=date y=close/group=stock attrid=myid;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV id="tinyMceEditorKsharp_2" class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV id="tinyMceEditorKsharp_5" class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV id="tinyMceEditorKsharp_4" class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 15 Aug 2023 12:09:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-and-patterns-to-each-category-of-a-variable-in/m-p/889326#M39510</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-08-15T12:09:00Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning colors and patterns to each category of a variable in sgplot</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-and-patterns-to-each-category-of-a-variable-in/m-p/889330#M39513</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1692101920457.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/86733i191E1A998CC51D3F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1692101920457.png" alt="Ksharp_0-1692101920457.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2023 12:18:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-and-patterns-to-each-category-of-a-variable-in/m-p/889330#M39513</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-08-15T12:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning colors and patterns to each category of a variable in sgplot</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-and-patterns-to-each-category-of-a-variable-in/m-p/889591#M39537</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have incorporated your code as following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;data dattrmap;&lt;BR /&gt;retain ID "myid";&lt;BR /&gt;INPUT value :$20. linethickness linecolor $ linepattern $;&lt;BR /&gt;datalines;&lt;BR /&gt;One 2 red soild&lt;BR /&gt;TWO 2 red dash&lt;BR /&gt;THREE 2 blue solid&lt;BR /&gt;FOUR 2 blue dash&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;ods graphics on;&lt;BR /&gt;proc sgplot data=numbers dattrmap=dattrmap;&lt;BR /&gt;where time between 0 and 53;&lt;BR /&gt;series x=time y=rate / group=group_cat attrid=myid;&lt;BR /&gt;keylegend / title='Group Categories' position=right;&lt;BR /&gt;xaxis grid label="Week";&lt;BR /&gt;yaxis grid;&lt;BR /&gt;run;&lt;BR /&gt;ods graphics off;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However, this gives me an error:&amp;nbsp;ERROR 772-580: Syntax error: expecting a constant or a dynamic.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2023 06:15:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-and-patterns-to-each-category-of-a-variable-in/m-p/889591#M39537</guid>
      <dc:creator>Novice_</dc:creator>
      <dc:date>2023-08-17T06:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning colors and patterns to each category of a variable in sgplot</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-and-patterns-to-each-category-of-a-variable-in/m-p/889595#M39538</link>
      <description>Thank you so much.&lt;BR /&gt;Both options work. I tried both and found that the datacontrastcolors gives less control compared to the other one.&lt;BR /&gt;Best Regards&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Aug 2023 08:12:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-and-patterns-to-each-category-of-a-variable-in/m-p/889595#M39538</guid>
      <dc:creator>Novice_</dc:creator>
      <dc:date>2023-08-17T08:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning colors and patterns to each category of a variable in sgplot</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-and-patterns-to-each-category-of-a-variable-in/m-p/889596#M39539</link>
      <description>I think I got it. Perhaps I should have added the ID in the input statement.&lt;BR /&gt;Thanks a lot.</description>
      <pubDate>Thu, 17 Aug 2023 08:14:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-and-patterns-to-each-category-of-a-variable-in/m-p/889596#M39539</guid>
      <dc:creator>Novice_</dc:creator>
      <dc:date>2023-08-17T08:14:20Z</dc:date>
    </item>
  </channel>
</rss>

