<?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: Smallest values with packed data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Smallest-values-with-packed-data/m-p/150611#M29697</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;MISSING does not apply for CHARACTER strings.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your IF statement is testing if the ASCII codes for the first three characters in the input stream is larger than the ASCII code for a single space.&lt;/P&gt;&lt;P&gt;So if the first byte of your binary packed decimal value happens to have a hexadecimal value less than '20'X then the IF will be false.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I store 10 into PD3. format I get the value '000010'x. This is definitely less than ' ' as binary zero that is in the first byte is less than the binary 32 stored as the value of space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I try to store numeric missing into PD3. format I get the value '800000'x.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Jun 2014 23:55:31 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2014-06-20T23:55:31Z</dc:date>
    <item>
      <title>Smallest values with packed data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Smallest-values-with-packed-data/m-p/150610#M29696</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-top: 1.0pt; margin-bottom: 1.0pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;Most text books say that the smallest values are the missing values: ""(character) and .(numeric)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 1.0pt; margin-bottom: 1.0pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;Apparently, this applies only to regular unpacked data.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 1.0pt; margin-bottom: 1.0pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;The byte that represents packed data seems to be smaller than the usual missing ""(character) value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-top: 1.0pt; margin-bottom: 1.0pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;Such bytes don't have any meaning and can appear to be symbols like:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 1.0pt; margin-bottom: 1.0pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;Null, start of heading, start of text, end of text, punch off, horizontal tab...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-top: 1.0pt; margin-bottom: 1.0pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;I thought that such symbols would be greater than missing "", but apparently they're less than or equal to missing.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 1.0pt; margin-bottom: 1.0pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;This is in z/OS EBCDIC using SAS 9.2, but I expect similar results in Windows ASCII.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-top: 1.0pt; margin-bottom: 1.0pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;Specific example: trying to read a packed decimal field conditionally:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 1.0pt; margin-bottom: 1.0pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; if substr(_infile_,1,3)&amp;gt;'' then input @1 var1&amp;nbsp; pd3. ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 1.0pt; margin-bottom: 1.0pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;This line doesn't produce an error, but the IF expression is always false, so it looks like packed bytes are less than or equal to missing.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;Please correct me if I'm wrong.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2014 22:53:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Smallest-values-with-packed-data/m-p/150610#M29696</guid>
      <dc:creator>agoldma</dc:creator>
      <dc:date>2014-06-20T22:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Smallest values with packed data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Smallest-values-with-packed-data/m-p/150611#M29697</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;MISSING does not apply for CHARACTER strings.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your IF statement is testing if the ASCII codes for the first three characters in the input stream is larger than the ASCII code for a single space.&lt;/P&gt;&lt;P&gt;So if the first byte of your binary packed decimal value happens to have a hexadecimal value less than '20'X then the IF will be false.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I store 10 into PD3. format I get the value '000010'x. This is definitely less than ' ' as binary zero that is in the first byte is less than the binary 32 stored as the value of space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I try to store numeric missing into PD3. format I get the value '800000'x.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2014 23:55:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Smallest-values-with-packed-data/m-p/150611#M29697</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-06-20T23:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: Smallest values with packed data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Smallest-values-with-packed-data/m-p/150612#M29698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-top: 1.0pt; margin-bottom: 1.0pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;The &lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000989178.htm"&gt;Definition of Missing Values&lt;/A&gt; recognizes "missing character value as a blank space", so I would rather say that SAS considers the space character " " to be equivalent to an empty character string "".&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 1.0pt; margin-bottom: 1.0pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;This is the part that I forgot. Thank you for reminding me about this.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 1.0pt; margin-bottom: 1.0pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;If "" = " ", and " "='20'x in ASCII and '40'x in EBCDIC, then there are many opportunities for some packed bytes to be smaller than '20'x and even more opportunities to be smaller than '40'x.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-top: 1.0pt; margin-bottom: 1.0pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;Also, I should've read the last 2 sentences of &lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/67227/HTML/default/viewer.htm#p0tmoipp0ci6wkn0z27ev47sv0ov.htm"&gt;Order of Missing Values&lt;/A&gt; in SAS Help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 1.0pt; margin-bottom: 1.0pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;In my specific example, the only thing that I'm trying to avoid is spaces, so I should've excluded only spaces instead of a range of characters:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 1.0pt; margin-bottom: 1.0pt; text-indent: .5in;"&gt;&lt;SPAN style="font-family: 'Courier New'; background-color: #ffffff;"&gt;if substr(_infile_,1,3) &lt;STRONG&gt;ne&lt;/STRONG&gt; '' then input @1 var1&amp;nbsp; pd3. ;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jun 2014 16:51:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Smallest-values-with-packed-data/m-p/150612#M29698</guid>
      <dc:creator>agoldma</dc:creator>
      <dc:date>2014-06-21T16:51:37Z</dc:date>
    </item>
  </channel>
</rss>

