<?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 Where Statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Where-Statement/m-p/455819#M115369</link>
    <description>&lt;P&gt;This minimal working example is supposed to generate "temp" with "x" from 0.1 to 0.9 by 0.1, and separates it observation by observation from "temp1" to "temp9," but SAS works well with x∈{1,2,4,5,6,7}, while it doesn't with x∈{3,8,9}. I cannot even guess what's wrong with this code since it's too simple.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp;
	do x=0.1 to 0.9 by 0.1;
		output;
	end;
run;

%macro separate;

%do x=1 %to 9;

/*--------------------------------------------------
This only works with x in 1, 2, 4, 5, 6 and 7.
--------------------------------------------------*/
data temp&amp;amp;x.;
	set temp;
	where x=0.&amp;amp;x.;
run;

%end;

%mend;

%separate;

quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks in advance. By the way, I tried if instead of where, but the result was same.&lt;/P&gt;</description>
    <pubDate>Fri, 20 Apr 2018 03:44:19 GMT</pubDate>
    <dc:creator>Junyong</dc:creator>
    <dc:date>2018-04-20T03:44:19Z</dc:date>
    <item>
      <title>Where Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-Statement/m-p/455819#M115369</link>
      <description>&lt;P&gt;This minimal working example is supposed to generate "temp" with "x" from 0.1 to 0.9 by 0.1, and separates it observation by observation from "temp1" to "temp9," but SAS works well with x∈{1,2,4,5,6,7}, while it doesn't with x∈{3,8,9}. I cannot even guess what's wrong with this code since it's too simple.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp;
	do x=0.1 to 0.9 by 0.1;
		output;
	end;
run;

%macro separate;

%do x=1 %to 9;

/*--------------------------------------------------
This only works with x in 1, 2, 4, 5, 6 and 7.
--------------------------------------------------*/
data temp&amp;amp;x.;
	set temp;
	where x=0.&amp;amp;x.;
run;

%end;

%mend;

%separate;

quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks in advance. By the way, I tried if instead of where, but the result was same.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 03:44:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-Statement/m-p/455819#M115369</guid>
      <dc:creator>Junyong</dc:creator>
      <dc:date>2018-04-20T03:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: Where Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-Statement/m-p/455825#M115374</link>
      <description>&lt;P&gt;Run this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data t; 
  set temp;	
  A=X-round(X,0.1); 
  format A 32.16;
 run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; X&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;0.1&amp;nbsp; &amp;nbsp;0.0000000000000000&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;0.2&amp;nbsp; &amp;nbsp;0.0000000000000000&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;0.3&amp;nbsp; &amp;nbsp;0.0000000000000001&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;0.4&amp;nbsp; &amp;nbsp;0.0000000000000000&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;0.5&amp;nbsp; &amp;nbsp;0.0000000000000000&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;0.6&amp;nbsp; &amp;nbsp;0.0000000000000000&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;0.7&amp;nbsp; &amp;nbsp;0.0000000000000000&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;0.8&amp;nbsp; -0.0000000000000001&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;0.9&amp;nbsp; -0.0000000000000001&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and read about numeric precision in SAS (and elsewhere).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All has been said already. Time to learn how computers work. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 04:23:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-Statement/m-p/455825#M115374</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-04-20T04:23:54Z</dc:date>
    </item>
    <item>
      <title>Re: Where Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-Statement/m-p/455826#M115375</link>
      <description>&lt;P&gt;Thank you, Chris. I modified the original code.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp;
	do x=0.1 to 0.9 by 0.1;
		output;
	end;
run;

%macro separate;

%do x=1 %to 9;

data temp&amp;amp;x.;
	set temp;
	where round(x,0.1)=0.&amp;amp;x.;
run;

%end;

%mend;

%separate;

quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;With no reason I thought that there is no numerical concern in SAS as it displays 0.3 rather than 0.3000000000000001. I'd better be more careful if it's a float type.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 04:38:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-Statement/m-p/455826#M115375</guid>
      <dc:creator>Junyong</dc:creator>
      <dc:date>2018-04-20T04:38:27Z</dc:date>
    </item>
  </channel>
</rss>

