<?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: Gaps Before and After GPLOT in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Gaps-Before-and-After-GPLOT/m-p/559022#M156064</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/173881"&gt;@Junyong&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Suppose I have a time-series variable x as follows.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _;
do t=1 to 1000;
x+rannor(1);
output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I can do PROC GPLOT to draw the time-series plot.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename _ "!userprofile\desktop\_.png";
goption gsfname=_ device=png gsfmode=replace;
ods results=off;
symbol i=join;
proc gplot;
format t yymmn6.;
plot x*t;
run;
ods results=on;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then, the following is the result.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="0.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29530i8BF1758D7DA6A9AC/image-size/large?v=v2&amp;amp;px=999" role="button" title="0.png" alt="0.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;This is reasonable as there is nearly no gap before and after the time span. Let's assume, however, t from 1001 to 2000 rather than 1 to 1000.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _;
do t=1001 to 2000;
x+rannor(1);
output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then, SAS spits out the following result.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29531i040A42AF976E992C/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;As above, SAS makes a significantly larger gap before the plot starts. I cannot eliminate the gap even after subsetting using WHERE in PROC GPLOT. I cannot understand the way SAS works at this point—there must be no difference as far as I know—but can I control the gap size?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Probably time to move to the more modern SGPLOT but to explain why you Axis appears as shown: You are using a default Axis. Without specific rules to create axis tick marks SAS uses an algorithm based on the ranges of values and for date and time formats, some of the format information. The larger the range of values the more likely to get your "gap" to place "nice" intervals for the tick marks. For a learning point you might change the format to yyq. instead, which displays year and calendar quarter, and see what that does to the "gap"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To control appearance of the AXIS values you have 1) assign properties to an Axis statement and 2) tell the procedure which axis definition to use for the axis using the HAXIS= or VAXIS= to use that Axis definition. Or you can list specific values on an HAXIS statement.&lt;/P&gt;
&lt;P&gt;You might try adding HAXIS =( '01OCT1962'd to '01JUL1965'd by quarter) so the first tick is for Oct 1962 instead of July.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc gplot;
   format t yymmn6.;
   plot x*t / HAXIS =( '01OCT1962'd to '01JUL1965'd by quarter)
   ;
run;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 May 2019 15:39:58 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-05-15T15:39:58Z</dc:date>
    <item>
      <title>Gaps Before and After GPLOT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Gaps-Before-and-After-GPLOT/m-p/558812#M155994</link>
      <description>&lt;P&gt;Suppose I have a time-series variable x as follows.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _;
do t=1 to 1000;
x+rannor(1);
output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I can do PROC GPLOT to draw the time-series plot.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename _ "!userprofile\desktop\_.png";
goption gsfname=_ device=png gsfmode=replace;
ods results=off;
symbol i=join;
proc gplot;
format t yymmn6.;
plot x*t;
run;
ods results=on;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then, the following is the result.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="0.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29530i8BF1758D7DA6A9AC/image-size/large?v=v2&amp;amp;px=999" role="button" title="0.png" alt="0.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This is reasonable as there is nearly no gap before and after the time span. Let's assume, however, t from 1001 to 2000 rather than 1 to 1000.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _;
do t=1001 to 2000;
x+rannor(1);
output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then, SAS spits out the following result.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29531i040A42AF976E992C/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;As above, SAS makes a significantly larger gap before the plot starts. I cannot eliminate the gap even after subsetting using WHERE in PROC GPLOT. I cannot understand the way SAS works at this point—there must be no difference as far as I know—but can I control the gap size?&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 06:35:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Gaps-Before-and-After-GPLOT/m-p/558812#M155994</guid>
      <dc:creator>Junyong</dc:creator>
      <dc:date>2019-05-15T06:35:43Z</dc:date>
    </item>
    <item>
      <title>Re: Gaps Before and After GPLOT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Gaps-Before-and-After-GPLOT/m-p/558946#M156035</link>
      <description>&lt;P&gt;Can you just use sgplot?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sgplot data=_;&lt;BR /&gt;format t yymmn6.;&lt;BR /&gt;series x=t y=x;&lt;BR /&gt;xaxis min=1004;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV class="c"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 15 May 2019 14:12:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Gaps-Before-and-After-GPLOT/m-p/558946#M156035</guid>
      <dc:creator>cminard</dc:creator>
      <dc:date>2019-05-15T14:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: Gaps Before and After GPLOT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Gaps-Before-and-After-GPLOT/m-p/559022#M156064</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/173881"&gt;@Junyong&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Suppose I have a time-series variable x as follows.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _;
do t=1 to 1000;
x+rannor(1);
output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I can do PROC GPLOT to draw the time-series plot.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename _ "!userprofile\desktop\_.png";
goption gsfname=_ device=png gsfmode=replace;
ods results=off;
symbol i=join;
proc gplot;
format t yymmn6.;
plot x*t;
run;
ods results=on;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then, the following is the result.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="0.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29530i8BF1758D7DA6A9AC/image-size/large?v=v2&amp;amp;px=999" role="button" title="0.png" alt="0.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;This is reasonable as there is nearly no gap before and after the time span. Let's assume, however, t from 1001 to 2000 rather than 1 to 1000.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _;
do t=1001 to 2000;
x+rannor(1);
output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then, SAS spits out the following result.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29531i040A42AF976E992C/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;As above, SAS makes a significantly larger gap before the plot starts. I cannot eliminate the gap even after subsetting using WHERE in PROC GPLOT. I cannot understand the way SAS works at this point—there must be no difference as far as I know—but can I control the gap size?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Probably time to move to the more modern SGPLOT but to explain why you Axis appears as shown: You are using a default Axis. Without specific rules to create axis tick marks SAS uses an algorithm based on the ranges of values and for date and time formats, some of the format information. The larger the range of values the more likely to get your "gap" to place "nice" intervals for the tick marks. For a learning point you might change the format to yyq. instead, which displays year and calendar quarter, and see what that does to the "gap"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To control appearance of the AXIS values you have 1) assign properties to an Axis statement and 2) tell the procedure which axis definition to use for the axis using the HAXIS= or VAXIS= to use that Axis definition. Or you can list specific values on an HAXIS statement.&lt;/P&gt;
&lt;P&gt;You might try adding HAXIS =( '01OCT1962'd to '01JUL1965'd by quarter) so the first tick is for Oct 1962 instead of July.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc gplot;
   format t yymmn6.;
   plot x*t / HAXIS =( '01OCT1962'd to '01JUL1965'd by quarter)
   ;
run;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 15:39:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Gaps-Before-and-After-GPLOT/m-p/559022#M156064</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-05-15T15:39:58Z</dc:date>
    </item>
  </channel>
</rss>

