<?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 SGPLOT - Attrmap and Proc Format not working together in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-Attrmap-and-Proc-Format-not-working-together/m-p/482363#M16641</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to use Attrmap and a proc format but they seem to&amp;nbsp;cancel each other over.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I run the code without the &lt;EM&gt;format Simplification typeFmt.&lt;/EM&gt; I get the green from the Attrmap - as expected -&amp;nbsp; and legend = 0 (pic 1).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I run with&amp;nbsp;&lt;SPAN&gt;&lt;EM&gt;format Simplification typeFmt.&lt;/EM&gt; I loose the formatting from Attrmap and the legend &amp;nbsp; = Pre trial (pic2)&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way I can have both&amp;nbsp; - Attrmap and the proc format work together. Green columns from the Attrmap and a legend shows Pre trial and Post Trial.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Attrmap;
	Retain id "myid";
	input value $ fillcolor $8.;
	datalines;
	0 VIBG
	1 BIBG
	;
run;

proc format;
	value typeFmt
		0 = "Pre Trial"
		1 = "Post Trial" 
	;
	ods graphics on / width=9in height=5in;

Proc SGPLOT data=work.DSCMax noborder dattrmap=attrmap;
	*/
	format Simplification typeFmt.;
	VBAR EVENT_DT / Response=Max_answer_tm Group=Simplification attrid=myid nooutline seglabel seglabelattrs=(weight=Bold color=WHITE size=8 );
	yaxis display=(noline noticks) grid values=(0 to 3600 by 300) offsetmin=0 label='mm:ss';
RUN;

ODS graphics OFF;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Apologies if the test data doesn't run - this is what it looks like though&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
	Input CD EVENT_DT Group Simplification MAX_ANSWER_TM;
	Datalines;
TSDa 	2018-07-06	DSC	0	38:21
TSDa	2018-07-09	DSC	0	9:41
TSDa	2018-07-10	DSC	0	23:31
TSDa	2018-07-11	DSC	0	14:47
TSDa	2018-07-12	DSC	0	17:40
TSDa	2018-07-13	DSC	0	20:34
TSDa	2018-07-16	DSC	0	8:55
TSDa	2018-07-17	DSC	0	22:17
TSDa	2018-07-18	DSC	0	16:42
TSDa	2018-07-19	DSC	0	10:31
TSDa	2018-07-20	DSC	0	11:12
TSDa	2018-07-23	DSC	0	10:13
TSDa	2018-07-24	DSC	0	6:37
TSDa	2018-07-25	DSC	0	17:00
TSDa	2018-07-26	DSC	0	7:11
TSDa	2018-07-27	DSC	0	10:43
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;Pic 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Pic 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture1.JPG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22104i2811DB72714061C9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture1.JPG" alt="Capture1.JPG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture2.JPG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22105iBA4AA8D11FAB9F58/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture2.JPG" alt="Capture2.JPG" /&gt;&lt;/span&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;</description>
    <pubDate>Mon, 30 Jul 2018 04:54:39 GMT</pubDate>
    <dc:creator>DME790</dc:creator>
    <dc:date>2018-07-30T04:54:39Z</dc:date>
    <item>
      <title>SGPLOT - Attrmap and Proc Format not working together</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-Attrmap-and-Proc-Format-not-working-together/m-p/482363#M16641</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to use Attrmap and a proc format but they seem to&amp;nbsp;cancel each other over.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I run the code without the &lt;EM&gt;format Simplification typeFmt.&lt;/EM&gt; I get the green from the Attrmap - as expected -&amp;nbsp; and legend = 0 (pic 1).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I run with&amp;nbsp;&lt;SPAN&gt;&lt;EM&gt;format Simplification typeFmt.&lt;/EM&gt; I loose the formatting from Attrmap and the legend &amp;nbsp; = Pre trial (pic2)&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way I can have both&amp;nbsp; - Attrmap and the proc format work together. Green columns from the Attrmap and a legend shows Pre trial and Post Trial.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Attrmap;
	Retain id "myid";
	input value $ fillcolor $8.;
	datalines;
	0 VIBG
	1 BIBG
	;
run;

proc format;
	value typeFmt
		0 = "Pre Trial"
		1 = "Post Trial" 
	;
	ods graphics on / width=9in height=5in;

Proc SGPLOT data=work.DSCMax noborder dattrmap=attrmap;
	*/
	format Simplification typeFmt.;
	VBAR EVENT_DT / Response=Max_answer_tm Group=Simplification attrid=myid nooutline seglabel seglabelattrs=(weight=Bold color=WHITE size=8 );
	yaxis display=(noline noticks) grid values=(0 to 3600 by 300) offsetmin=0 label='mm:ss';
RUN;

ODS graphics OFF;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Apologies if the test data doesn't run - this is what it looks like though&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
	Input CD EVENT_DT Group Simplification MAX_ANSWER_TM;
	Datalines;
TSDa 	2018-07-06	DSC	0	38:21
TSDa	2018-07-09	DSC	0	9:41
TSDa	2018-07-10	DSC	0	23:31
TSDa	2018-07-11	DSC	0	14:47
TSDa	2018-07-12	DSC	0	17:40
TSDa	2018-07-13	DSC	0	20:34
TSDa	2018-07-16	DSC	0	8:55
TSDa	2018-07-17	DSC	0	22:17
TSDa	2018-07-18	DSC	0	16:42
TSDa	2018-07-19	DSC	0	10:31
TSDa	2018-07-20	DSC	0	11:12
TSDa	2018-07-23	DSC	0	10:13
TSDa	2018-07-24	DSC	0	6:37
TSDa	2018-07-25	DSC	0	17:00
TSDa	2018-07-26	DSC	0	7:11
TSDa	2018-07-27	DSC	0	10:43
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;Pic 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Pic 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture1.JPG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22104i2811DB72714061C9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture1.JPG" alt="Capture1.JPG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture2.JPG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22105iBA4AA8D11FAB9F58/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture2.JPG" alt="Capture2.JPG" /&gt;&lt;/span&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;</description>
      <pubDate>Mon, 30 Jul 2018 04:54:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-Attrmap-and-Proc-Format-not-working-together/m-p/482363#M16641</guid>
      <dc:creator>DME790</dc:creator>
      <dc:date>2018-07-30T04:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT - Attrmap and Proc Format not working together</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-Attrmap-and-Proc-Format-not-working-together/m-p/482408#M16642</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/75899"&gt;@DME790&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to the &lt;A href="http://documentation.sas.com/?docsetId=grstatproc&amp;amp;docsetTarget=n18szqcwir8q2nn10od9hhdh2ksj.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;documentation&lt;/A&gt;:&amp;nbsp;"If the group value is formatted, then the text-string in the attribute map data set must contain the formatted value."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, just modify variable VALUE in dataset ATTRMAP:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input cd $ event_dt :yymmdd. group $ Simplification max_answer_tm :time.;
max_answer_tm=max_answer_tm/60;
format event_dt yymmdd10. max_answer_tm mmss.;
label event_dt='Event Date';
datalines;
TSDa 2018-07-06 DSC 0 38:21
TSDa 2018-07-09 DSC 0 9:41
TSDa 2018-07-10 DSC 0 23:31
TSDa 2018-07-11 DSC 0 14:47
TSDa 2018-07-12 DSC 0 17:40
TSDa 2018-07-13 DSC 0 20:34
TSDa 2018-07-16 DSC 0 8:55
TSDa 2018-07-17 DSC 0 22:17
TSDa 2018-07-18 DSC 0 16:42
TSDa 2018-07-19 DSC 0 10:31
TSDa 2018-07-20 DSC 0 11:12
TSDa 2018-07-23 DSC 0 10:13
TSDa 2018-07-24 DSC 0 6:37
TSDa 2018-07-25 DSC 0 17:00
TSDa 2018-07-26 DSC 0 7:11
TSDa 2018-07-27 DSC 0 10:43
TSDa 2018-07-27 DSC 1 -0:01
; /* last obs. added to force "Post Trial" into the legend */

data attrmap;
retain id "myid";
input value :&amp;amp;$10. fillcolor $8.;
datalines;
Pre Trial   VIBG
Post Trial  BIBG
;

ods graphics on / width=9in height=5in;

proc sgplot data=test noborder dattrmap=attrmap;
format Simplification typeFmt.;
vbar event_dt / response=max_answer_tm group=Simplification attrid=myid nooutline seglabel seglabelattrs=(weight=bold color=white size=8 );
yaxis display=(noline noticks) grid values=(0 to 3600 by 300) offsetmin=0 label='mm:ss';
run;

ods graphics off;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you don't need "Post Trial" in the legend if only "Pre Trial" values occur in the graph, just delete the dummy observation that I've added.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jul 2018 10:29:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-Attrmap-and-Proc-Format-not-working-together/m-p/482408#M16642</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2018-07-30T10:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT - Attrmap and Proc Format not working together</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-Attrmap-and-Proc-Format-not-working-together/m-p/482646#M16648</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Works a treat&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dean&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jul 2018 23:11:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-Attrmap-and-Proc-Format-not-working-together/m-p/482646#M16648</guid>
      <dc:creator>DME790</dc:creator>
      <dc:date>2018-07-30T23:11:55Z</dc:date>
    </item>
  </channel>
</rss>

