<?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 Reference line using date with yymmn6 format in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Reference-line-using-date-with-yymmn6-format/m-p/699771#M20741</link>
    <description>&lt;P&gt;I'm using sgplot and am&amp;nbsp;trying to add a reference line for a certain month (march 2020)&amp;nbsp;when I have the x-axis variable&amp;nbsp;formated&amp;nbsp;as yymmn6. However, using this sample code I get the following warning:&lt;/P&gt;&lt;P&gt;WARNING: X='202003' is invalid. The plot will not be drawn.&amp;nbsp; Which gives me the plot, without the reference line. How do I formulate the refline statement to get my line to show up?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input monthno count;
datalines;
202001 78
202002 67
202003 99
202004 56
202005 63
202006 82
;
run;

data test;
set test;
time=input(put(monthno,6.),yymmn6.);
format time yymmn6.;
run;

proc sgplot data= test;
	yaxis label="Amount";
	xaxis label="Month";
	series x=time y=count;
	refline '202003' /axis=x;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 18 Nov 2020 12:49:14 GMT</pubDate>
    <dc:creator>AnkaS</dc:creator>
    <dc:date>2020-11-18T12:49:14Z</dc:date>
    <item>
      <title>Reference line using date with yymmn6 format</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Reference-line-using-date-with-yymmn6-format/m-p/699771#M20741</link>
      <description>&lt;P&gt;I'm using sgplot and am&amp;nbsp;trying to add a reference line for a certain month (march 2020)&amp;nbsp;when I have the x-axis variable&amp;nbsp;formated&amp;nbsp;as yymmn6. However, using this sample code I get the following warning:&lt;/P&gt;&lt;P&gt;WARNING: X='202003' is invalid. The plot will not be drawn.&amp;nbsp; Which gives me the plot, without the reference line. How do I formulate the refline statement to get my line to show up?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input monthno count;
datalines;
202001 78
202002 67
202003 99
202004 56
202005 63
202006 82
;
run;

data test;
set test;
time=input(put(monthno,6.),yymmn6.);
format time yymmn6.;
run;

proc sgplot data= test;
	yaxis label="Amount";
	xaxis label="Month";
	series x=time y=count;
	refline '202003' /axis=x;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Nov 2020 12:49:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Reference-line-using-date-with-yymmn6-format/m-p/699771#M20741</guid>
      <dc:creator>AnkaS</dc:creator>
      <dc:date>2020-11-18T12:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: Reference line using date with yymmn6 format</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Reference-line-using-date-with-yymmn6-format/m-p/699773#M20742</link>
      <description>Try;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;refline '1mar2020'd /axis=x;</description>
      <pubDate>Wed, 18 Nov 2020 12:52:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Reference-line-using-date-with-yymmn6-format/m-p/699773#M20742</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-11-18T12:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: Reference line using date with yymmn6 format</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Reference-line-using-date-with-yymmn6-format/m-p/699775#M20743</link>
      <description>&lt;P&gt;You can't specify a character variable value in this case for the X axis, which is numeric. You need to specify a numeric value, which in this case is 01MAR2020&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;refline '01MAR2020'd /axis=x;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Nov 2020 12:55:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Reference-line-using-date-with-yymmn6-format/m-p/699775#M20743</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-11-18T12:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: Reference line using date with yymmn6 format</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Reference-line-using-date-with-yymmn6-format/m-p/699776#M20744</link>
      <description>&lt;P&gt;Use a Date Constant&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data= test;
	yaxis label="Amount";
	xaxis label="Month";
	series x=time y=count;
	refline "01mar2020"d /axis=x;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Nov 2020 12:58:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Reference-line-using-date-with-yymmn6-format/m-p/699776#M20744</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-11-18T12:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: Reference line using date with yymmn6 format</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Reference-line-using-date-with-yymmn6-format/m-p/699791#M20745</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/357452"&gt;@AnkaS&lt;/a&gt;&amp;nbsp;and welcome to the SAS Support Communities!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My first thought was also to specify a date literal or other numeric value, but it turned out that your formatted value &lt;FONT face="courier new,courier"&gt;'202003'&lt;/FONT&gt; works better &lt;EM&gt;if&lt;/EM&gt; you add the option &lt;FONT face="courier new,courier"&gt;type=discrete&lt;/FONT&gt; to the XAXIS statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;xaxis label="Month" type=discrete;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Without this option the x-axis tick mark labels did not even honor the YYMMN6. format in my SAS session, but were displayed in an "automatically generated" format, as a note in the log said.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(Edit: Changing the axis type to "discrete" would of course change the appearance of the graph if the &lt;FONT face="courier new,courier"&gt;monthno&lt;/FONT&gt; values weren't equidistant.)&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 13:45:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Reference-line-using-date-with-yymmn6-format/m-p/699791#M20745</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-11-18T13:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: Reference line using date with yymmn6 format</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Reference-line-using-date-with-yymmn6-format/m-p/700192#M20746</link>
      <description>Thank you, all. That solved it.</description>
      <pubDate>Thu, 19 Nov 2020 13:24:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Reference-line-using-date-with-yymmn6-format/m-p/700192#M20746</guid>
      <dc:creator>AnkaS</dc:creator>
      <dc:date>2020-11-19T13:24:19Z</dc:date>
    </item>
  </channel>
</rss>

