<?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: Help assigning colors to multiple options in group in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Help-assigning-colors-to-multiple-options-in-group/m-p/936777#M24829</link>
    <description>&lt;P&gt;Exact length usually does not matter but the values in the Dattrmap have be considered equal by SAS. Which means if the values of the variable Eventtype have leading spaces then the value in the Dattrmap data set would have to have leading spaces and the exact number. SAS will normally ignore trailing spaces when comparing for equality.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Case matters as well. If the value of the variable in the plot data set is "ABC" then the value in the Dattrmap set has to be "ABC", not "Abc" or "abc".&lt;/P&gt;</description>
    <pubDate>Tue, 23 Jul 2024 14:29:09 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2024-07-23T14:29:09Z</dc:date>
    <item>
      <title>Help assigning colors to multiple options in group</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Help-assigning-colors-to-multiple-options-in-group/m-p/936751#M24826</link>
      <description>&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am fairly new to SAS and am trying to assign specific colors to certain options in a group I have. I am trying to make a graph to show the frequency of catastrophic sport injuries that have occurred over the past few years and the event type distribution for those injuries for every state in the U.S. I have my years on the x axis and then have clustered the event types on each year. I tried using an attribute map to assign my colors and then used a macro to code for a few states at once. However, my colors are not as I assigned them, and they keep switching between states. Ideally, I am hoping to have the colors be consistent between all states. If anyone has suggestions on how to assign colors, I would greatly appreciate that! Thank you for the help in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is below for my color assignment and graphing:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;/*ASSIGNING COLORS TO DIFFERENT EVENT TYPES*/&lt;/DIV&gt;&lt;DIV&gt;data sreportmap2;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;length ID $10 value $6 linecolor $ 9 fillcolor $ 9;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;input ID $ value $ linecolor $ fillcolor $;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;datalines;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;BarAttr Competition/Game Green Green&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;BarAttr Conditioning Yellow Yellow&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;BarAttr Non-athletic Gray Gray&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;BarAttr Other Black Black&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;BarAttr OtherTeam Purple Purple&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;BarAttr Practice Orange Orange&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;BarAttr Scrimmage Lime Lime&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;BarAttr Strength/Weight Pink Pink&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;BarAttr Unafilliated Lightblue Lightblue&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;run;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;/*making my graph here*/&lt;/DIV&gt;&lt;DIV&gt;%macro chart7 (stateM=, title=);&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;title "&amp;amp;title for &amp;amp;stateM";&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;proc sgplot data = sreport dattrmap=sreportmap2;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;where state=&amp;amp;stateM;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;vbar yearacademic / attrid=BarAttr categoryorder=respdesc group=eventtype groupdisplay=cluster;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;xaxis label = "Academic Year";&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;yaxis label = "Frequency";&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;%mend chart7;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;%chart7 (stateM="Florida", title="Frequency of Catastrophic Injuries among Event Types from 2013 to 2022");&lt;/DIV&gt;&lt;DIV&gt;%chart7 (stateM="Ohio", title="Fatality Outcomes of Catastrophic Injuries among all Sports from 2013 to 2022");&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 12:39:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Help-assigning-colors-to-multiple-options-in-group/m-p/936751#M24826</guid>
      <dc:creator>lilyduboff</dc:creator>
      <dc:date>2024-07-23T12:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: Help assigning colors to multiple options in group</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Help-assigning-colors-to-multiple-options-in-group/m-p/936763#M24827</link>
      <description>&lt;P&gt;What are the formatted values of the group variable Eventtype?&lt;/P&gt;
&lt;P&gt;The values in the Dattrmap data set have to match. Since your Sreportmap2 data set define the values as 6 characters long and then attempts to read value that are mostly longer than 6 I strongly suspect your values do not match those of Eventtype.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example data in the form of a working data step of the Sreport data set may allow us to provide working code.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 13:57:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Help-assigning-colors-to-multiple-options-in-group/m-p/936763#M24827</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-07-23T13:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: Help assigning colors to multiple options in group</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Help-assigning-colors-to-multiple-options-in-group/m-p/936774#M24828</link>
      <description>&lt;P&gt;My eventtype variable has a length of 150 and the format is "$150." The possible event types are the following: Competition/Game, Conditioning Session, Non-athletic activity, Other, Other Team activity, Practice, Scrimmage, Strength/Weight Session, Unaffiliated Recreational Activity.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Should I change my dattrmap to this to account for the longer length?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data sreportmap2;&lt;BR /&gt;length ID $10 value $150 linecolor $ 9 fillcolor $ 9;&lt;BR /&gt;input ID $ value $ linecolor $ fillcolor $;&lt;BR /&gt;datalines;&lt;BR /&gt;BarAttr Competition/Game Green Green&lt;BR /&gt;BarAttr Conditioning Yellow Yellow&lt;BR /&gt;BarAttr Non-athletic Gray Gray&lt;BR /&gt;BarAttr Other Black Black&lt;BR /&gt;BarAttr OtherTeam Purple Purple&lt;BR /&gt;BarAttr Practice Orange Orange&lt;BR /&gt;BarAttr Scrimmage Lime Lime&lt;BR /&gt;BarAttr Strength/Weight Pink Pink&lt;BR /&gt;BarAttr Unafilliated Lightblue Lightblue&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 14:20:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Help-assigning-colors-to-multiple-options-in-group/m-p/936774#M24828</guid>
      <dc:creator>lilyduboff</dc:creator>
      <dc:date>2024-07-23T14:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: Help assigning colors to multiple options in group</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Help-assigning-colors-to-multiple-options-in-group/m-p/936777#M24829</link>
      <description>&lt;P&gt;Exact length usually does not matter but the values in the Dattrmap have be considered equal by SAS. Which means if the values of the variable Eventtype have leading spaces then the value in the Dattrmap data set would have to have leading spaces and the exact number. SAS will normally ignore trailing spaces when comparing for equality.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Case matters as well. If the value of the variable in the plot data set is "ABC" then the value in the Dattrmap set has to be "ABC", not "Abc" or "abc".&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 14:29:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Help-assigning-colors-to-multiple-options-in-group/m-p/936777#M24829</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-07-23T14:29:09Z</dc:date>
    </item>
  </channel>
</rss>

