<?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: dattrmap in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/dattrmap/m-p/725275#M225242</link>
    <description>&lt;P&gt;It may be time to actually provide example data.&lt;/P&gt;
&lt;P&gt;With some dummy data this "works"&lt;/P&gt;
&lt;PRE&gt;data barcol ;
length id value fillcolor $50 ;
retain linecolor "black" ;
id = "coht"; value = "1 x 10^7 cells" ; fillcolor = "red" ; output;
id = "coht"; value = "2 x 10^8 cells" ; fillcolor = "green" ; output;
id = "coht"; value = "2 x 10^7 cells" ; fillcolor = "orange" ; output;
run;


data plot;
  infile datalines dlm=',' truncover;
  input subj start end1 coht :$14.;
datalines;
1,5,15,1 x 10^7 cells
2,3,12,2 x 10^8 cells 
3,4,18,2 x 10^7 cells
;

proc sgplot data=plot  noautolegend nocycleattrs dattrmap=barcol;
   styleattrs wallcolor = lightyellow ;
   highlow y=subj low=start high=end1 /  group=coht 
   type=bar nooutline nomissinggroup   name = 'proj' attrid = coht ; 
run;
 &lt;/PRE&gt;
&lt;P&gt;When we say the Value variable has to match the Group variable values you cannot have any difference. From the code you post for the dattrmap set you might have a difference in spaces.&lt;/P&gt;
&lt;P&gt;Another potential headache is exactly which character and character set is used for the ^. If one is the programming ^ you get from your keyboard with Shift+6 key that may not be a UNICODE character that looks like it from your data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run proc contents on both your dattrmap data set and the data set you are plotting.&lt;/P&gt;
&lt;P&gt;In this part of the output:&lt;/P&gt;
&lt;PRE&gt;                                      The CONTENTS Procedure

           Data Set Name        WORK.PLOT                     Observations          3
           Member Type          DATA                          Variables             4
           Engine               V9                            Indexes               0
           Created              03/10/2021 14:38:02           Observation Length    40
           Last Modified        03/10/2021 14:38:02           Deleted Observations  0
           Protection                                         Compressed            NO
           Data Set Type                                      Sorted                NO
           Label
           Data Representation  WINDOWS_64
           Encoding             wlatin1  Western (Windows)


&lt;/PRE&gt;
&lt;P&gt;If the text following Encoding is not the same you have different characters sets and the equality becomes problematic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 10 Mar 2021 21:44:23 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-03-10T21:44:23Z</dc:date>
    <item>
      <title>dattrmap</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dattrmap/m-p/725260#M225233</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am creating this dataset below to assign different color to bars based on values.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data barcol ;&lt;BR /&gt;length id value fillcolor $50 ;&lt;BR /&gt;retain linecolor "black" ;&lt;BR /&gt;id = "coht"; value = "1 x 10^7 cells" ; fillcolor = "red" ; output;&lt;BR /&gt;id = "coht"; value = "2 x 10^8 cells" ; fillcolor = "green" ; output;&lt;BR /&gt;id = "coht"; value = "2 x 10^7 cells" ; fillcolor = "orange" ; output;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem is caret sign (^) is causing an issue when I am using it in proc sgplot (see below). I am getting &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;warning message&amp;nbsp;Duplicate values are not permitted in DiscreteAttrMap: 2 x 10 cells.&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;It seems it is &lt;STRONG&gt;not considering caret sign (^).&amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;proc sgplot data=final&amp;nbsp; noautolegend nocycleattrs dattrmap=barcol;&lt;BR /&gt;styleattrs wallcolor = lightyellow ;&lt;BR /&gt;highlow y=subj low=start high=end1 / highcap=acap group=coht type=bar nooutline nomissinggroup&amp;nbsp; &amp;nbsp;name = 'proj' attrid = coht ;&amp;nbsp;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Any suggestion on how to make it work? Thanks in advance.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 20:26:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dattrmap/m-p/725260#M225233</guid>
      <dc:creator>Leo9</dc:creator>
      <dc:date>2021-03-10T20:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: dattrmap</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dattrmap/m-p/725271#M225239</link>
      <description>Instead of typing out the values, can you get them from your data to avoid the issue? Or try using the ascii code (94) with the BYTE function to get the text as desired. &lt;BR /&gt;&lt;BR /&gt;Maybe this:&lt;BR /&gt;value = catt("2 x 10", byte(94), "8 cells";</description>
      <pubDate>Wed, 10 Mar 2021 21:32:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dattrmap/m-p/725271#M225239</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-03-10T21:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: dattrmap</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dattrmap/m-p/725275#M225242</link>
      <description>&lt;P&gt;It may be time to actually provide example data.&lt;/P&gt;
&lt;P&gt;With some dummy data this "works"&lt;/P&gt;
&lt;PRE&gt;data barcol ;
length id value fillcolor $50 ;
retain linecolor "black" ;
id = "coht"; value = "1 x 10^7 cells" ; fillcolor = "red" ; output;
id = "coht"; value = "2 x 10^8 cells" ; fillcolor = "green" ; output;
id = "coht"; value = "2 x 10^7 cells" ; fillcolor = "orange" ; output;
run;


data plot;
  infile datalines dlm=',' truncover;
  input subj start end1 coht :$14.;
datalines;
1,5,15,1 x 10^7 cells
2,3,12,2 x 10^8 cells 
3,4,18,2 x 10^7 cells
;

proc sgplot data=plot  noautolegend nocycleattrs dattrmap=barcol;
   styleattrs wallcolor = lightyellow ;
   highlow y=subj low=start high=end1 /  group=coht 
   type=bar nooutline nomissinggroup   name = 'proj' attrid = coht ; 
run;
 &lt;/PRE&gt;
&lt;P&gt;When we say the Value variable has to match the Group variable values you cannot have any difference. From the code you post for the dattrmap set you might have a difference in spaces.&lt;/P&gt;
&lt;P&gt;Another potential headache is exactly which character and character set is used for the ^. If one is the programming ^ you get from your keyboard with Shift+6 key that may not be a UNICODE character that looks like it from your data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run proc contents on both your dattrmap data set and the data set you are plotting.&lt;/P&gt;
&lt;P&gt;In this part of the output:&lt;/P&gt;
&lt;PRE&gt;                                      The CONTENTS Procedure

           Data Set Name        WORK.PLOT                     Observations          3
           Member Type          DATA                          Variables             4
           Engine               V9                            Indexes               0
           Created              03/10/2021 14:38:02           Observation Length    40
           Last Modified        03/10/2021 14:38:02           Deleted Observations  0
           Protection                                         Compressed            NO
           Data Set Type                                      Sorted                NO
           Label
           Data Representation  WINDOWS_64
           Encoding             wlatin1  Western (Windows)


&lt;/PRE&gt;
&lt;P&gt;If the text following Encoding is not the same you have different characters sets and the equality becomes problematic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 21:44:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dattrmap/m-p/725275#M225242</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-03-10T21:44:23Z</dc:date>
    </item>
    <item>
      <title>Re: dattrmap</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dattrmap/m-p/726940#M225977</link>
      <description>&lt;P&gt;I tried both solution but none is working&lt;/P&gt;</description>
      <pubDate>Tue, 16 Mar 2021 23:42:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dattrmap/m-p/726940#M225977</guid>
      <dc:creator>Leo9</dc:creator>
      <dc:date>2021-03-16T23:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: dattrmap</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dattrmap/m-p/727149#M226093</link>
      <description>Show what you tried.</description>
      <pubDate>Wed, 17 Mar 2021 15:57:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dattrmap/m-p/727149#M226093</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-03-17T15:57:58Z</dc:date>
    </item>
  </channel>
</rss>

