<?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: SGPlot inconsistencies with VLine, RefLine, and axis options in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/SGPlot-inconsistencies-with-VLine-RefLine-and-axis-options/m-p/981129#M25762</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;For the third problem, as mentioned, you do need to be aware of the axis type being used to determine the values for the reference line.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When using the VLINE statement, the axis type is discrete. As a result, the reference line value needs to match the tick value. Using '01JAN2025' wouldn't work, but using '01Jan2025' would work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
  do visitdate='29dec2024'd to '04jan2025'd;
    y=1;
    output;
end;
run;
proc sgplot data = sample;
   vline visitdate;
   refLine  '01Jan2025'  / axis = x;
   format visitdate date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For the SCATTER statement, the axis type is linear, so you could use either 23742 or '01JAN2025'd to specify the location of the reference line.&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=sample;
  scatter y=y x=VisitDate;
   refLine  23742       / axis = x lineattrs=(color=cream thickness=10px);
   refLine '01JAN2025'd / axis = x lineattrs=(color=black thickness=2px);
   format visitdate date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Setting the axis type to TIME also allows you to specify the internal date value or the date literal, as you determined.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 19 Dec 2025 22:39:48 GMT</pubDate>
    <dc:creator>MarciaS</dc:creator>
    <dc:date>2025-12-19T22:39:48Z</dc:date>
    <item>
      <title>SGPlot inconsistencies with VLine, RefLine, and axis options</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPlot-inconsistencies-with-VLine-RefLine-and-axis-options/m-p/981039#M25759</link>
      <description>&lt;P&gt;&amp;nbsp;Howdy!&amp;nbsp; I have some odd behavior.&amp;nbsp; I don't need a solution, just looking for some explanation.&amp;nbsp; Here's my code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sGPlot data = check pctLevel = group;
    vLine VisitDate / group = Consent stat = percent lineAttrs = (thickness = 2);
    refLine '14JAN2025'd '11MAR2025'd / axis = x lineAttrs = (thickness = 1);

    xAxis type = time interval = day values = ('01JAN2025'd to '31MAR2025'd by 1) noTimeSplit fitPolicy = rotate;
    format VisitDate e8601Da.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This code does not apply the format &lt;CODE class=" language-sas" style="font-size: 13px; white-space: normal;"&gt;e8601Da.&lt;/CODE&gt; to the x-axis value text (Visit Dates).&amp;nbsp; Instead of showing&amp;nbsp;&lt;CODE class=" language-sas" style="font-size: 13px; white-space: normal;"&gt;2025-01-01&lt;/CODE&gt;, it shows&amp;nbsp;&lt;CODE class=" language-sas" style="font-size: 13px; white-space: normal;"&gt;01JAN25&lt;/CODE&gt;.&amp;nbsp; If I change the format to &lt;CODE class=" language-sas" style="font-size: 13px; white-space: normal;"&gt;yymmdd10.&lt;/CODE&gt;, the format is correctly applied.&amp;nbsp; It seems to be something particular with&amp;nbsp;&lt;CODE class=" language-sas" style="font-size: 13px; white-space: normal;"&gt;e8601Da.&lt;/CODE&gt; and similar date formats.&amp;nbsp; If I change the format to &lt;CODE class=" language-sas" style="font-size: 13px; white-space: normal;"&gt;10.2&lt;/CODE&gt;, it also does not correctly apply the format.&amp;nbsp; Instead of &lt;CODE class=" language-sas" style="font-size: 13px; white-space: normal;"&gt;23742.00&lt;/CODE&gt;, I only get &lt;CODE class=" language-sas" style="font-size: 13px; white-space: normal;"&gt;23742&lt;/CODE&gt;.&amp;nbsp; If I try &lt;CODE class=" language-sas" style="font-size: 13px; white-space: normal;"&gt;e10.4&lt;/CODE&gt;, instead of getting &lt;CODE class=" language-sas" style="font-size: 13px; white-space: normal;"&gt;2.3742E4&lt;/CODE&gt;, I only get &lt;CODE class=" language-sas" style="font-size: 13px; white-space: normal;"&gt;2.374E4&lt;/CODE&gt;.&amp;nbsp; It appears that &lt;CODE class=" language-sas" style="font-size: 13px; white-space: normal;"&gt;SGPLot&lt;/CODE&gt; is recognizing general classes of formats (regular number, scientific notation, date), but it is not honoring the specific format requested.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is not specific to &lt;CODE class=" language-sas" style="font-size: 13px; white-space: normal;"&gt;VLine&lt;/CODE&gt;.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
    input x y;

    datalines;
1 1
2 2
3 3
4 4
;
run;

ods graphics / height = 2in width = 6in;
proc sGPlot data = a;  series x = x y = y;                       run;
proc sGPlot data = a;  series x = x y = y;  format x e8601Da. ;  run;
proc sGPlot data = a;  series x = x y = y;  format x yymmdd10.;  run;
proc sGPlot data = a;  series x = x y = y;  format x best.    ;  run;
proc sGPlot data = a;  series x = x y = y;  format x 1.       ;  run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In this case, none of the formats are honored.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A second issue I figured out on my own.&amp;nbsp; &lt;CODE class=" language-sas" style="font-size: 13px; white-space: normal;"&gt;SGPLot&lt;/CODE&gt; was not honoring either the &lt;CODE class=" language-sas" style="font-size: 13px; white-space: normal;"&gt;values = ()&lt;/CODE&gt;&amp;nbsp;list nor the&amp;nbsp;&lt;FONT face="Consolas, Monaco, Andale Mono, Ubuntu Mono, monospace" color="#000000"&gt;&lt;SPAN&gt;fitPolicy&lt;/SPAN&gt;&lt;/FONT&gt;&amp;nbsp;until I also added &lt;CODE class=" language-sas" style="font-size: 13px; white-space: normal;"&gt;noTimeSplit&lt;/CODE&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A third issue is that I can only add a &lt;CODE class=" language-sas" style="font-size: 13px; white-space: normal;"&gt;RefLine&lt;/CODE&gt; when the x-axis is designated a time axis: i.e.,&amp;nbsp;&lt;CODE class=" language-sas" style="font-size: 13px; white-space: normal;"&gt;type = time&lt;/CODE&gt;.&amp;nbsp; When I format my dates as regular numbers (e.g. &lt;CODE class=" language-sas" style="font-size: 13px; white-space: normal;"&gt;23742&lt;/CODE&gt;), I can add a vertical reference line at any of those values without problem with any axis type.&amp;nbsp; But if I format them as a date without specifying that the x-axis is time, then the &lt;CODE class=" language-sas" style="font-size: 13px; white-space: normal;"&gt;RefLine&lt;/CODE&gt;s will not show up, no matter how I specify the values.&amp;nbsp; For example, none of these work.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;    refLine  23742       / axis = x;
    refLine '01JAN2025'd / axis = x;
    refLine  01JAN2025'  / axis = x;
    xAxis;
    format VisitDate date9.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The only way to get a reference line when the x-axis values look like dates is to specify like this.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;    refLine '01JAN2025'd / axis = x;
    xAxis &lt;FONT color="#FF0000"&gt;&lt;U&gt;type = time&lt;/U&gt;&lt;/FONT&gt;;
    format VisitDate date9.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have solutions for my particular code: use &lt;CODE class=" language-sas" style="font-size: 13px; white-space: normal;"&gt;type = time&lt;/CODE&gt; and use format &lt;CODE class=" language-sas" style="font-size: 13px; white-space: normal;"&gt;yymmdd10.&lt;/CODE&gt;.&amp;nbsp; I'm just trying to understand why these aren't working like I'd expect.&amp;nbsp; Is there a hidden rationale, or are these just limitations of SGPlot?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Happy holiday!&lt;/P&gt;
&lt;P&gt;Michael&lt;/P&gt;</description>
      <pubDate>Thu, 18 Dec 2025 18:52:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPlot-inconsistencies-with-VLine-RefLine-and-axis-options/m-p/981039#M25759</guid>
      <dc:creator>Kastchei</dc:creator>
      <dc:date>2025-12-18T18:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: SGPlot inconsistencies with VLine, RefLine, and axis options</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPlot-inconsistencies-with-VLine-RefLine-and-axis-options/m-p/981056#M25760</link>
      <description>&lt;P&gt;One part of the answer (definitely not the whole answer) is that there is a documented list of formats that are not supported by the Graphics Template Language, and e8601da is on the list of unsupported formats.&amp;nbsp;&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatgraph/n0o4b33j6ue5bkn1viojbbvwzkba.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatgraph/n0o4b33j6ue5bkn1viojbbvwzkba.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No clue what about the iso8601 formats would make them difficult to support in GTL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd be curious to see the full code for an example of your third problem.&amp;nbsp; If adding the xaxis statement with type=time fixed the problem, then it's a good bet that without that, SGPLOT guessed that the axis type was linear.&amp;nbsp; You can end up with some weird looking plots if SGPLOT guesses the wrong axis type. In below example SGPLOT guesses the axis should be linear, because there is no format attached to the variable.&amp;nbsp; Using valuesformat will format the xaxis as dates, but note they repeat because it's a linear axis:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
    input x y;
    datalines;
1 1
2 2
3 3
4 4
;
run;

proc sGPlot data = a; 
  scatter x = x y = y; 
  xaxis valuesformat=date9. ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Quentin_0-1766094729443.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112350i50C615FE029B44E7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Quentin_0-1766094729443.png" alt="Quentin_0-1766094729443.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Dec 2025 21:52:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPlot-inconsistencies-with-VLine-RefLine-and-axis-options/m-p/981056#M25760</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2025-12-18T21:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: SGPlot inconsistencies with VLine, RefLine, and axis options</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPlot-inconsistencies-with-VLine-RefLine-and-axis-options/m-p/981118#M25761</link>
      <description>&lt;P&gt;If you want to display a dash in the date look at the YYMMDDXw format. The X position lets you use a list of characters in that position, B C D N P and S which will then use a Blank, Colon, Hyphen (dash), nothing, Period or Slash as the separator between the elements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that custom rolled date, time and datetime formats created with Proc Format are also not going to display properly in graph axis.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Dec 2025 19:54:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPlot-inconsistencies-with-VLine-RefLine-and-axis-options/m-p/981118#M25761</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2025-12-19T19:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: SGPlot inconsistencies with VLine, RefLine, and axis options</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPlot-inconsistencies-with-VLine-RefLine-and-axis-options/m-p/981129#M25762</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;For the third problem, as mentioned, you do need to be aware of the axis type being used to determine the values for the reference line.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When using the VLINE statement, the axis type is discrete. As a result, the reference line value needs to match the tick value. Using '01JAN2025' wouldn't work, but using '01Jan2025' would work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
  do visitdate='29dec2024'd to '04jan2025'd;
    y=1;
    output;
end;
run;
proc sgplot data = sample;
   vline visitdate;
   refLine  '01Jan2025'  / axis = x;
   format visitdate date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For the SCATTER statement, the axis type is linear, so you could use either 23742 or '01JAN2025'd to specify the location of the reference line.&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=sample;
  scatter y=y x=VisitDate;
   refLine  23742       / axis = x lineattrs=(color=cream thickness=10px);
   refLine '01JAN2025'd / axis = x lineattrs=(color=black thickness=2px);
   format visitdate date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Setting the axis type to TIME also allows you to specify the internal date value or the date literal, as you determined.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Dec 2025 22:39:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPlot-inconsistencies-with-VLine-RefLine-and-axis-options/m-p/981129#M25762</guid>
      <dc:creator>MarciaS</dc:creator>
      <dc:date>2025-12-19T22:39:48Z</dc:date>
    </item>
  </channel>
</rss>

