<?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: How to BLOCK Correctly in SGPLOT SERIES? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-BLOCK-Correctly-in-SGPLOT-SERIES/m-p/743198#M232619</link>
    <description>&lt;P&gt;You could make your variable a string:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt; T = put(mdy(I,1,2020),yymmdd.);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 23 May 2021 07:47:27 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2021-05-23T07:47:27Z</dc:date>
    <item>
      <title>How to BLOCK Correctly in SGPLOT SERIES?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-BLOCK-Correctly-in-SGPLOT-SERIES/m-p/743174#M232601</link>
      <description>&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatproc/n0ikbvq5nwz6ezn1czzi40aw048o.htm" target="_blank"&gt;SGPLOT Procedure BLOCK Statement&lt;/A&gt; shows the following image with blocks around dots—for example, the observation for Janet is located in the middle of the second red box.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="images_blockposcenter.png" style="width: 434px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59686iD7DAB4E5A554C8E0/image-size/large?v=v2&amp;amp;px=999" role="button" title="images_blockposcenter.png" alt="images_blockposcenter.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I use both SERIES and BLOCK as follows—as a working example, 12 observations from January to December 2020 are displayed. A dummy variable equals one only in February and zero otherwise. The outcome, unlike the plot above, draws the February block after the second dot.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SGPlot.png" style="width: 640px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59688i528DA1546B750E4F/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPlot.png" alt="SGPlot.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;As in the first, I want the block in the middle rather than on the right of the dot. In this case, how can I relocate the block? The following is the MWE code.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data i;
	do i=1 to 12;
		t=mdy(i,1,2020);
		x+rannor(1);
		y=i=2;
		output;
	end;
run;

data j;
	input id :$ value fillcolor :$ filltransparency @@;
cards;
i 0 black 1 i 1 black 0.9
;

ods results=off;
ods listing gpath="!userprofile\desktop";
ods graphics/reset;

proc sgplot data=i dattrmap=j;
	series x=t y=x;
	block x=t block=y/attrid=i nooutline novalues;
	xaxis valuesformat=yymmddn6.;
quit;

ods graphics/reset;
ods listing gpath=none;
ods results=on;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 22 May 2021 20:59:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-BLOCK-Correctly-in-SGPLOT-SERIES/m-p/743174#M232601</guid>
      <dc:creator>Junyong</dc:creator>
      <dc:date>2021-05-22T20:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to BLOCK Correctly in SGPLOT SERIES?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-BLOCK-Correctly-in-SGPLOT-SERIES/m-p/743198#M232619</link>
      <description>&lt;P&gt;You could make your variable a string:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt; T = put(mdy(I,1,2020),yymmdd.);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 23 May 2021 07:47:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-BLOCK-Correctly-in-SGPLOT-SERIES/m-p/743198#M232619</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-05-23T07:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to BLOCK Correctly in SGPLOT SERIES?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-BLOCK-Correctly-in-SGPLOT-SERIES/m-p/743204#M232623</link>
      <description>&lt;P&gt;Add the points that you want to use as the boundary of the block region. Then create a binary variable that indicates whether t is in the region that you want to shade. For example, the following program uses 15Jan and 15Feb as boundary values:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Left  = mdy(1,15,2020);
%let Right = mdy(2,15,2020);

data i;
	do i=1 to 12;
		t=mdy(i,1,2020);
		x+rannor(1);
		output;
	end;
run;
/* add points at boundary of block */
data Block;
t = &amp;amp;Left;  output;
t = &amp;amp;Right; output;
run;
/* merge boundary values and then sort */
data All;
merge i Block;
by t;
BlockID = (t&amp;gt;=&amp;amp;Left &amp;amp; t&amp;lt;&amp;amp;Right);
format t DATE9.;
run;

proc sort data=All; by t; run;

data j;
	input id :$ value fillcolor :$ filltransparency @@;
cards;
i 0 black 1 i 1 black 0.9
;

proc sgplot data=All dattrmap=j;
	series x=t y=x;
	block x=t block=blockID /attrid=i nooutline novalues;
	xaxis valuesformat=yymmddn9.;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 23 May 2021 10:49:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-BLOCK-Correctly-in-SGPLOT-SERIES/m-p/743204#M232623</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-05-23T10:49:29Z</dc:date>
    </item>
  </channel>
</rss>

