<?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: proc format issue with cntlin &amp; eexcl in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/proc-format-issue-with-cntlin-eexcl/m-p/87577#M24985</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you looked at the FUZZ option in PROC FORMAT?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 May 2013 17:33:41 GMT</pubDate>
    <dc:creator>Peter_C</dc:creator>
    <dc:date>2013-05-28T17:33:41Z</dc:date>
    <item>
      <title>proc format issue with cntlin &amp; eexcl</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-format-issue-with-cntlin-eexcl/m-p/87576#M24984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm getting unpredictable behavior from a format created with CNTLIN and EEXCL='Y'.&amp;nbsp; For some ranges the upper bound is excluded (as I want), but for others it is included.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', 'courier';"&gt;data a;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', 'courier';"&gt;eexcl='Y';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', 'courier';"&gt;fmtname='gpa';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', 'courier';"&gt;do i=2 to 4 by 0.1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', 'courier';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; start=i;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', 'courier';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end=i+0.1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', 'courier';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; label=put(start,4.2)||'-'||put(end-0.01,4.2);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', 'courier';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', 'courier';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', 'courier';"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', 'courier';"&gt;proc format cntlin=a; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', 'courier';"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', 'courier';"&gt;proc print data=a;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', 'courier';"&gt;format i gpa.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', 'courier';"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', 'courier';"&gt;data b;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', 'courier';"&gt;do i=2,2.6,3,3.55,4;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', 'courier';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; j=i;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', 'courier';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', 'courier';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', 'courier';"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', 'courier';"&gt;proc print data=b;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', 'courier';"&gt;format j gpa.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', 'courier';"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first proc print applies the new format to the set that created it, and it works as expected.&amp;nbsp; The second print applies the format to new data.&amp;nbsp; I get wrong formats applied to values of 2.6 and 4 (note that each of those formatted as expected in the first proc print).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An identical format created using a VALUE statement and ranges like &lt;SPAN style="font-family: mceinline;"&gt;&lt;SPAN style="font-family: 'courier new', 'courier';"&gt;2-&amp;lt;2.1='2.00-2.09'&lt;/SPAN&gt; doesn't behave like this, and PROC COMPARE thinks the 2 formats (as described in a CNTLOUT set) are identical.&amp;nbsp; Setting HLO='M' doesn't seem to affect the behavior.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: mceinline;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: mceinline;"&gt;Is this a bug or am I missing some obvious error in my code?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: mceinline;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: mceinline;"&gt;(problem occurs in Enterprise Guide 4.1 and Windows SAS 9.2)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 May 2013 13:49:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-format-issue-with-cntlin-eexcl/m-p/87576#M24984</guid>
      <dc:creator>PhilipBatty</dc:creator>
      <dc:date>2013-05-28T13:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: proc format issue with cntlin &amp; eexcl</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-format-issue-with-cntlin-eexcl/m-p/87577#M24985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you looked at the FUZZ option in PROC FORMAT?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 May 2013 17:33:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-format-issue-with-cntlin-eexcl/m-p/87577#M24985</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2013-05-28T17:33:41Z</dc:date>
    </item>
    <item>
      <title>Re: proc format issue with cntlin &amp; eexcl</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-format-issue-with-cntlin-eexcl/m-p/87578#M24986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the suggestion.&amp;nbsp; I tried fuzz=0, but still get same result.&amp;nbsp; Is there some other value I should try?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 May 2013 17:58:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-format-issue-with-cntlin-eexcl/m-p/87578#M24986</guid>
      <dc:creator>PhilipBatty</dc:creator>
      <dc:date>2013-05-28T17:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: proc format issue with cntlin &amp; eexcl</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-format-issue-with-cntlin-eexcl/m-p/87579#M24987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Frequently programs that use 0.1 repeatedly in a computation will run into this problem. This is because it's not possible to represent 0.1 exactly in binary, and after a few repititions the errors accumulate. Try this version of your test. Observe that the ranges created by the first data step (by adding 0.1 to the previous number) are slightly different than the values in the 2nd data step. See &lt;A href="http://support.sas.com/techsup/technote/ts230.html" title="http://support.sas.com/techsup/technote/ts230.html"&gt;TS-DOC: TS-230 - Dealing with Numeric Representation Error in SAS Applications&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data a;&lt;/P&gt;&lt;P&gt;eexcl='Y';&lt;/P&gt;&lt;P&gt;fmtname='gpa';&lt;/P&gt;&lt;P&gt;do i=2 to 4 by 0.1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; start=i;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i2 = i;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end=i+0.1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; label=put(start,4.2)||'-'||put(end-0.01,4.2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format cntlin=a; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data=a;&lt;/P&gt;&lt;P&gt;format i gpa.;&lt;/P&gt;&lt;P&gt;format i2 hex16.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data b;&lt;/P&gt;&lt;P&gt;do i=2,2.6,3,3.55,4;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; j=i;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; j2 = j;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data=b;&lt;/P&gt;&lt;P&gt;format j gpa.;&lt;/P&gt;&lt;P&gt;format j2 hex16.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 May 2013 18:02:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-format-issue-with-cntlin-eexcl/m-p/87579#M24987</guid>
      <dc:creator>Tim_SAS</dc:creator>
      <dc:date>2013-05-28T18:02:00Z</dc:date>
    </item>
    <item>
      <title>Re: proc format issue with cntlin &amp; eexcl</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-format-issue-with-cntlin-eexcl/m-p/87580#M24988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As &lt;A __default_attr="227858" __jive_macro_name="user" class="jive_macro jive_macro_user" href="https://communities.sas.com/"&gt;&lt;/A&gt; pointed out, the problem occurs when rounding errors accumulate. The way to avoid this is to use numbers with exact representations as much as possible so that rounding occurs only once and the FUZZ factor is enough to take care of the error. Along those lines, your example could be rewritten:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data aa;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;eexcl='Y';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;fmtname='gpaa';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;do i=20 to 40;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; start=i*0.1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end=(i+1)*0.1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; label=put(start,4.2)||'-'||put(end-0.01,4.2);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc format cntlin=aa; run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc print data=aa;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;format i gpaa.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data b;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;do i=2,2.6,3,3.55,4;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; j=i;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc print data=b;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;format j gpaa.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 May 2013 18:58:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-format-issue-with-cntlin-eexcl/m-p/87580#M24988</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-05-28T18:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: proc format issue with cntlin &amp; eexcl</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-format-issue-with-cntlin-eexcl/m-p/87581#M24989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Tim.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got users specifying formatting intervals like "by0.1at0" (for ranges of width 0.1 with the lowest range staring at 0). I think if I convert the interval width to an integer, then convert back to the original scale within the loop (like PGStats also suggests) I'll avoid compounding the errors.&amp;nbsp; I may need to impose a limit to the allowed precision (e.g. "by1.000000at0" would have me counting by millions pointlessly).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks everybody! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 May 2013 19:04:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-format-issue-with-cntlin-eexcl/m-p/87581#M24989</guid>
      <dc:creator>PhilipBatty</dc:creator>
      <dc:date>2013-05-28T19:04:17Z</dc:date>
    </item>
  </channel>
</rss>

