<?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 sgplot-x axis - asterisks when using format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/sgplot-x-axis-asterisks-when-using-format/m-p/729473#M227001</link>
    <description>&lt;P&gt;&lt;SPAN&gt;When I run the code, below, WITHOUT &amp;nbsp;the format, I get the values on the x-axis.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I want to suppress every-other-year values (and the values at 1999, 2001, and 2008), so I'm trying &amp;nbsp;to use the format to set these values to blank – when I use the format, it suppresses the values I was hoping to suppress, but the values I expect to see are now an "*" instead of the values &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;(the variable PCT1, with a value for only year 2000, was created so I don't get a connected line with the values for years 2009 through 2019) &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
 data test;
 input YEAR	PCT	PCT1;
 cards;
2000	.	90
2009	71	.
2010	70	.
2011	68	.
2012	67	.
2013	64	.
2014	62	.
2015	61	.
2016	58	.
2017	55	.
2018	52	.
2019	51	.
;
run;

proc format;
value  y1fmt
1999 = ' '
2001 = ' '
2008 = ' ' 
2010 = ' ' 
2012 = ' '
2014 = ' '
2016 = ' '
2018 = ' ' ;
run;
 
proc sgplot data=test;  *format year   y1fmt.;
series y =  PCT x =  year /   markers;
scatter y = PCT1  x =  year;
xaxis integer  fitpolicy=none ranges=(1999-2001 2008-2019); 
 run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="SGPlot1.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56563i27B5E5CFDB5BED9E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SGPlot1.png" alt="SGPlot1.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="SGPlot2.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56564iB7BBD4DB1D90E56A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SGPlot2.png" alt="SGPlot2.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 26 Mar 2021 19:31:25 GMT</pubDate>
    <dc:creator>Dave25</dc:creator>
    <dc:date>2021-03-26T19:31:25Z</dc:date>
    <item>
      <title>sgplot-x axis - asterisks when using format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sgplot-x-axis-asterisks-when-using-format/m-p/729473#M227001</link>
      <description>&lt;P&gt;&lt;SPAN&gt;When I run the code, below, WITHOUT &amp;nbsp;the format, I get the values on the x-axis.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I want to suppress every-other-year values (and the values at 1999, 2001, and 2008), so I'm trying &amp;nbsp;to use the format to set these values to blank – when I use the format, it suppresses the values I was hoping to suppress, but the values I expect to see are now an "*" instead of the values &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;(the variable PCT1, with a value for only year 2000, was created so I don't get a connected line with the values for years 2009 through 2019) &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
 data test;
 input YEAR	PCT	PCT1;
 cards;
2000	.	90
2009	71	.
2010	70	.
2011	68	.
2012	67	.
2013	64	.
2014	62	.
2015	61	.
2016	58	.
2017	55	.
2018	52	.
2019	51	.
;
run;

proc format;
value  y1fmt
1999 = ' '
2001 = ' '
2008 = ' ' 
2010 = ' ' 
2012 = ' '
2014 = ' '
2016 = ' '
2018 = ' ' ;
run;
 
proc sgplot data=test;  *format year   y1fmt.;
series y =  PCT x =  year /   markers;
scatter y = PCT1  x =  year;
xaxis integer  fitpolicy=none ranges=(1999-2001 2008-2019); 
 run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="SGPlot1.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56563i27B5E5CFDB5BED9E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SGPlot1.png" alt="SGPlot1.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="SGPlot2.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56564iB7BBD4DB1D90E56A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SGPlot2.png" alt="SGPlot2.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Mar 2021 19:31:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sgplot-x-axis-asterisks-when-using-format/m-p/729473#M227001</guid>
      <dc:creator>Dave25</dc:creator>
      <dc:date>2021-03-26T19:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: sgplot-x axis - asterisks when using format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sgplot-x-axis-asterisks-when-using-format/m-p/729495#M227013</link>
      <description>&lt;P&gt;Try this format definition:&lt;/P&gt;
&lt;PRE&gt;proc format;
value  y1fmt (default=4)
1999 = ' '
2001 = ' '
2008 = ' ' 
2010 = ' ' 
2012 = ' '
2014 = ' '
2016 = ' '
2018 = ' ' 
;
run;&lt;/PRE&gt;
&lt;P&gt;Learning point: SAS will display * whenever you attempt to display more "value" then the format is defined to display.&lt;/P&gt;
&lt;P&gt;The way you defined the format SAS thought the values displayed should only occupy one character. So when you try to show 2017 it will not fit in the one space.&lt;/P&gt;
&lt;P&gt;Alternately you could use an explicit definition for all other values such as:&lt;/P&gt;
&lt;PRE&gt;proc format;
value  y1fmt 
1999 = ' '
2001 = ' '
2008 = ' ' 
2010 = ' ' 
2012 = ' '
2014 = ' '
2016 = ' '
2018 = ' ' 
other = [F4.0]
;
run;
&lt;/PRE&gt;
&lt;P&gt;Since this provides a specific format for the other values then they display.&lt;/P&gt;
&lt;P&gt;Note the way to reference another format as part of a definition uses [ ] around the other format name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Mar 2021 21:04:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sgplot-x-axis-asterisks-when-using-format/m-p/729495#M227013</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-03-26T21:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: sgplot-x axis - asterisks when using format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sgplot-x-axis-asterisks-when-using-format/m-p/729530#M227035</link>
      <description>nice teaching example - thank you!</description>
      <pubDate>Sat, 27 Mar 2021 03:32:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sgplot-x-axis-asterisks-when-using-format/m-p/729530#M227035</guid>
      <dc:creator>Dave25</dc:creator>
      <dc:date>2021-03-27T03:32:34Z</dc:date>
    </item>
  </channel>
</rss>

