<?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 Select Statement is giving me strange numbers in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Select-Statement-is-giving-me-strange-numbers/m-p/390322#M93603</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to SAS programming and am learning from "Learning SAS by Example".&lt;/P&gt;&lt;P&gt;One of the concepts I am looking at is the Select Statement. To my surprise, when I run the statement below, instead of getting numbers of Weight of 1.,5, 1.7, or 2.0, for North, South, and West and East&amp;nbsp; for each data point by Region, I am only getting a Weight reading for 'South' data, and the number I am getting is 1.69995117, not 1.7. Maybe someone can give me an explanation for this because I have explored all options and do not see why I am getting this result. Thanks a lot!&lt;/P&gt;&lt;P&gt;===========================================&lt;/P&gt;&lt;P&gt;Libname SASData '/folders/myfolders/SASData' ;&lt;BR /&gt;Data RegSales ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Set SasDATA.Sales ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;length Weight 3 ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Select (Region) ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;when ('North') Weight = 1.5 ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;when ('South') Weight = 1.7 ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;when ('West', 'East') Weight = 2.0 ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;otherwise Weight = 0 ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;End ;&lt;BR /&gt;run ;&lt;/P&gt;</description>
    <pubDate>Wed, 23 Aug 2017 16:19:43 GMT</pubDate>
    <dc:creator>ManitobaMoose</dc:creator>
    <dc:date>2017-08-23T16:19:43Z</dc:date>
    <item>
      <title>Select Statement is giving me strange numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-Statement-is-giving-me-strange-numbers/m-p/390322#M93603</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to SAS programming and am learning from "Learning SAS by Example".&lt;/P&gt;&lt;P&gt;One of the concepts I am looking at is the Select Statement. To my surprise, when I run the statement below, instead of getting numbers of Weight of 1.,5, 1.7, or 2.0, for North, South, and West and East&amp;nbsp; for each data point by Region, I am only getting a Weight reading for 'South' data, and the number I am getting is 1.69995117, not 1.7. Maybe someone can give me an explanation for this because I have explored all options and do not see why I am getting this result. Thanks a lot!&lt;/P&gt;&lt;P&gt;===========================================&lt;/P&gt;&lt;P&gt;Libname SASData '/folders/myfolders/SASData' ;&lt;BR /&gt;Data RegSales ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Set SasDATA.Sales ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;length Weight 3 ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Select (Region) ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;when ('North') Weight = 1.5 ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;when ('South') Weight = 1.7 ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;when ('West', 'East') Weight = 2.0 ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;otherwise Weight = 0 ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;End ;&lt;BR /&gt;run ;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2017 16:19:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-Statement-is-giving-me-strange-numbers/m-p/390322#M93603</guid>
      <dc:creator>ManitobaMoose</dc:creator>
      <dc:date>2017-08-23T16:19:43Z</dc:date>
    </item>
    <item>
      <title>Re: Select Statement is giving me strange numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-Statement-is-giving-me-strange-numbers/m-p/390325#M93604</link>
      <description>&lt;P&gt;It works fine for me. The 1.6999 has to do with your LENGTH statement.&lt;/P&gt;
&lt;P&gt;Typically a length of 8 is needed for a number. I think you're thinking of length as the number of characters but that's not how it works, it's the number of bytes.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Numerical Accuracy in SAS&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/69852/HTML/default/viewer.htm#p0ji1unv6thm0dn1gp4t01a1u0g6.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/69852/HTML/default/viewer.htm#p0ji1unv6thm0dn1gp4t01a1u0g6.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Length attributes:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/69852/HTML/default/viewer.htm#n08fs0rt7fikeln1uh0t8v5pt25d.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/69852/HTML/default/viewer.htm#n08fs0rt7fikeln1uh0t8v5pt25d.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2017 16:29:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-Statement-is-giving-me-strange-numbers/m-p/390325#M93604</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-23T16:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: Select Statement is giving me strange numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-Statement-is-giving-me-strange-numbers/m-p/390348#M93610</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The length statement completely makes sense. Thanks. What I still don't understand is why only the 'South' region weight is showing in the Output window, and not the weights for the other regions. If I can figure that out then I will be completely good to go.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;~Moose&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2017 17:17:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-Statement-is-giving-me-strange-numbers/m-p/390348#M93610</guid>
      <dc:creator>ManitobaMoose</dc:creator>
      <dc:date>2017-08-23T17:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: Select Statement is giving me strange numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-Statement-is-giving-me-strange-numbers/m-p/390361#M93615</link>
      <description>&lt;P&gt;That's not what I get when I run the same code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did a previous step modify the SALES data set? Verify the input data set is correct.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there's still an issue, post your full code and log.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2017 17:57:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-Statement-is-giving-me-strange-numbers/m-p/390361#M93615</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-23T17:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: Select Statement is giving me strange numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-Statement-is-giving-me-strange-numbers/m-p/390395#M93636</link>
      <description>&lt;P&gt;I see. I am getting only Weights for South in the Output Window, but when I proc print I get the correct weights in the results window. I guess everything is OK.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2017 19:25:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-Statement-is-giving-me-strange-numbers/m-p/390395#M93636</guid>
      <dc:creator>ManitobaMoose</dc:creator>
      <dc:date>2017-08-23T19:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: Select Statement is giving me strange numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-Statement-is-giving-me-strange-numbers/m-p/390398#M93639</link>
      <description>&lt;P&gt;Because you're creating a data set you shouldn't be seeing anything in the OUTPUT window.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you open the data set using the table viewer or proc print do you see the correct results? If so then everything is ok.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it possible you're seeing output from a previous procedure?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2017 19:34:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-Statement-is-giving-me-strange-numbers/m-p/390398#M93639</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-23T19:34:40Z</dc:date>
    </item>
  </channel>
</rss>

