<?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: Create a multi-colored block graph in ODS Graphics Designer in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Create-a-multi-colored-block-graph-in-ODS-Graphics-Designer/m-p/808874#M22786</link>
    <description>&lt;P&gt;I wrote more details and comments about using formats to bin numeric data, discrete attribute maps, and using heat maps for longitudinal data:&amp;nbsp;&lt;A href="https://blogs.sas.com/content/iml/2022/04/20/viz-ordinal-response-longitudinal.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2022/04/20/viz-ordinal-response-longitudinal.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Apr 2022 16:50:59 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2022-04-20T16:50:59Z</dc:date>
    <item>
      <title>Create a multi-colored block graph in ODS Graphics Designer</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Create-a-multi-colored-block-graph-in-ODS-Graphics-Designer/m-p/807871#M22770</link>
      <description>&lt;P&gt;I am trying to use ODS Graphics Designer to create the following graph:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mariko5797_0-1649954705739.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/70403i96140ED43087EF87/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mariko5797_0-1649954705739.png" alt="mariko5797_0-1649954705739.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I tried to use the "Block" plot, but it seems to only allow two colors: missing/not missing or multi-colors with no control over color assignment. Is there a way to create such a plot using ODS Graphics? I would prefer using designer since I need to stack a lot of graphs, but it's not a requirement.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2022 16:48:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Create-a-multi-colored-block-graph-in-ODS-Graphics-Designer/m-p/807871#M22770</guid>
      <dc:creator>mariko5797</dc:creator>
      <dc:date>2022-04-14T16:48:26Z</dc:date>
    </item>
    <item>
      <title>Re: Create a multi-colored block graph in ODS Graphics Designer</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Create-a-multi-colored-block-graph-in-ODS-Graphics-Designer/m-p/807878#M22772</link>
      <description>&lt;P&gt;Yes, this can be done; but can you tell more about your plot axis? Is it continuous or discrete? Do you want each of your block plots to be labeled?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2022 17:03:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Create-a-multi-colored-block-graph-in-ODS-Graphics-Designer/m-p/807878#M22772</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2022-04-14T17:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: Create a multi-colored block graph in ODS Graphics Designer</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Create-a-multi-colored-block-graph-in-ODS-Graphics-Designer/m-p/807884#M22773</link>
      <description>&lt;P&gt;Data is discrete and stored numerically: 1 (mild), 2 (moderate), 3 (severe), 0 (none), 5 (not collected). I do not need the boxes labelled with the values nor axis labelled as this plot will be under a scatter plot with the same axis.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2022 17:28:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Create-a-multi-colored-block-graph-in-ODS-Graphics-Designer/m-p/807884#M22773</guid>
      <dc:creator>mariko5797</dc:creator>
      <dc:date>2022-04-14T17:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: Create a multi-colored block graph in ODS Graphics Designer</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Create-a-multi-colored-block-graph-in-ODS-Graphics-Designer/m-p/807935#M22774</link>
      <description>&lt;P&gt;Normally, I would use PROC SGPLOT to do this; but for your case, I needed the REPEATEDVALUES option on the BLOCK plot, which is not currently surfaced in the SG procedures. To control the value/color association, modify the attrmap data set. To add more BLOCK plots, just add them inside the INNERMARGIN to stack them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;Dan&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc template;
define statgraph example;
begingraph;
layout overlay / xaxisopts=(discreteOpts=(tickvaluefitpolicy=SplitRotate));
   ScatterPlot X=Name Y=Weight / primary=true;
   InnerMargin / align=bottom;
      BlockPlot X=Name Block=age / Display=( Fill Outline Label ) NAME="block" repeatedvalues=true;
   EndInnerMargin;
   DiscreteLegend "block" / Location=Outside;
endlayout;
endgraph;
end;
run;

data attrmap;
retain ID "myid";
length fillcolor $ 6;
input value $ fillcolor $;
cards;
12 blue
13 green
14 yellow
15 orange
16 red
;
run;

proc sgrender data=sashelp.class template=example dattrmap=attrmap;
dattrvar age="myid";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Apr 2022 21:27:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Create-a-multi-colored-block-graph-in-ODS-Graphics-Designer/m-p/807935#M22774</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2022-04-14T21:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: Create a multi-colored block graph in ODS Graphics Designer</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Create-a-multi-colored-block-graph-in-ODS-Graphics-Designer/m-p/808160#M22784</link>
      <description>&lt;P&gt;If you are willing to eliminate the gap between each row, this can be done by using a heat map. For example, see the article, &lt;A href="https://blogs.sas.com/content/iml/2019/07/15/create-discrete-heat-map-sgplot.html" target="_self"&gt;"Create a discrete heat map with PROC SGPLOT"&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;You can use a discrete attribute map to assign colors to values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Clinical;
input SiteID @;
do Week = 0 to 13;
   input Count @;
   output;
end;
/* ID Wk1  Wk2  Wk3  Wk4 ... Wk14*/
datalines;
001  1 0 0 0 0 0 0 3 1 3 3 0 3 0
002  0 0 0 1 1 2 1 2 2 1 1 0 2 2
003  1 . . 1 0 1 0 3 . 1 0 3 2 1 
004  1 1 . 1 0 1 2 2 3 2 1 0 . 0
005  1 1 1 . 0 0 0 1 0 1 2 3 3 1
;

/* https://blogs.sas.com/content/iml/2019/07/15/create-discrete-heat-map-sgplot.html */
data DiscreteAttrOrder;                /* create discrete attribute map */
length Value $1 FillColor $15;
input Value FillColor;
retain ID 'Malaria'                    /* name of map */
     Show 'AttrMap';                   /* always show all groups in legend */
datalines;
.  Gray
0  White
1  CXFFFFB2
2  CXFD8D3C
3  CXBD0026
;

title "Heat Map of Malaria Data";
proc sgplot data=Clinical DATTRMAP=DiscreteAttrOrder;
   heatmapparm x=Week y=SiteID colorgroup=Count / outline outlineattrs=(color=gray)
               ATTRID=Malaria; 
   discretelegend;
   refline (1.5 to 5.5) / axis=Y lineattrs=(color=black thickness=2);
   xaxis integer values=(0 to 13) valueshint;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SGPlot58.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/70488iC55D81873DB08C0B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SGPlot58.png" alt="SGPlot58.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Sat, 16 Apr 2022 11:23:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Create-a-multi-colored-block-graph-in-ODS-Graphics-Designer/m-p/808160#M22784</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-04-16T11:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: Create a multi-colored block graph in ODS Graphics Designer</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Create-a-multi-colored-block-graph-in-ODS-Graphics-Designer/m-p/808874#M22786</link>
      <description>&lt;P&gt;I wrote more details and comments about using formats to bin numeric data, discrete attribute maps, and using heat maps for longitudinal data:&amp;nbsp;&lt;A href="https://blogs.sas.com/content/iml/2022/04/20/viz-ordinal-response-longitudinal.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2022/04/20/viz-ordinal-response-longitudinal.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 16:50:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Create-a-multi-colored-block-graph-in-ODS-Graphics-Designer/m-p/808874#M22786</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-04-20T16:50:59Z</dc:date>
    </item>
  </channel>
</rss>

