<?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: How to filter exponentiation values in sas dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-filter-exponentiation-values-in-sas-dataset/m-p/840129#M332198</link>
    <description>&lt;P&gt;You can just type in the value, just like you did in the assignment statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where a=6.7705698E14;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But the real value probably has more digits that what you are seeing.&lt;/P&gt;
&lt;P&gt;That looks like the output of the BEST12. format (which is what SAS normally uses when you haven't told it to use something else).&amp;nbsp; So of the 12 characters 3 are being used for the exponent and one for the decimal point so you only have 8 digits.&amp;nbsp; But 6 times 10 to the 14th power is 15 decimal digits.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;8    data test;
9      input @1 a @1 string $20. ;
10     string2=put(a,32.-L);
11     length = length(string);
12     length2 = length(string2);
13     format a 20.;
14     put (_all_) (=/);
15   cards;


a=677056980000000
string=6.7705698E14
string2=677056980000000
length=12
length2=15
&lt;/PRE&gt;
&lt;P&gt;So the real value might be any number in the range from&amp;nbsp;&lt;/P&gt;
&lt;P&gt;677,056,979,500,000 to&amp;nbsp;&lt;/P&gt;
&lt;P&gt;677,056,980,499,999&lt;/P&gt;</description>
    <pubDate>Sun, 23 Oct 2022 03:14:53 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-10-23T03:14:53Z</dc:date>
    <item>
      <title>How to filter exponentiation values in sas dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-filter-exponentiation-values-in-sas-dataset/m-p/839846#M332039</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the below dataset with&amp;nbsp;exponentiation values in variable 'a' and I want to filter the particular value (&lt;CODE class=" language-sas"&gt;6.7705698E14&lt;/CODE&gt;) in the dataset and how do I apply where condition or if statement to pull &lt;CODE class=" language-sas"&gt;6.7705698E14&lt;/CODE&gt;?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your help in advance!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;  
  a=6.5693077E14; output;  
  a=6.7705698E14; output;  
  a=6.8283942E14; output;  
  a=6.5693077E14; output;  
  a=6.7705698E14; output;  
  a=6.8283942E14; output;  
run;  &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 05:23:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-filter-exponentiation-values-in-sas-dataset/m-p/839846#M332039</guid>
      <dc:creator>1239</dc:creator>
      <dc:date>2022-10-21T05:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter exponentiation values in sas dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-filter-exponentiation-values-in-sas-dataset/m-p/839855#M332048</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set test;
where a = 6.7705698E14;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Oct 2022 06:50:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-filter-exponentiation-values-in-sas-dataset/m-p/839855#M332048</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-10-21T06:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter exponentiation values in sas dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-filter-exponentiation-values-in-sas-dataset/m-p/839901#M332074</link>
      <description>&lt;P&gt;Assuming you have specified number .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;  
  a=6.5693077E14; output;  
  a=6.7705698E14; output;  
  a=6.8283942E14; output;  
  a=6.5693077E14; output;  
  a=6.7705698E14; output;  
  a=6.8283942E14; output;  
run;  

data want;
 set test;
if int(a/1e7)=67705698;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Oct 2022 11:45:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-filter-exponentiation-values-in-sas-dataset/m-p/839901#M332074</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-10-21T11:45:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter exponentiation values in sas dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-filter-exponentiation-values-in-sas-dataset/m-p/840127#M332197</link>
      <description>&lt;P&gt;If this exponential data is stored in a numerical variable then it's just how the values get printed. You can always "attach" a different format to the variable so it prints differently. This doesn't change the internal storage of the value which also means you can express the value either with an exponent or just as digits.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.test;  
  a=6.5693077E14; output;  
  a=6.7705698E14; output;  
  a=6.8283942E14; output;  
  a=6.5693077E14; output;  
  a=6.7705698E14; output;  
  a=6.8283942E14; output;  
run;  

proc datasets lib=work nolist;
  modify test;
    format a f16.;
  run;
quit;

proc print data=test;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1666488868631.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76471i7D86A8A1BEBE1DE0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1666488868631.png" alt="Patrick_0-1666488868631.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 23 Oct 2022 01:36:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-filter-exponentiation-values-in-sas-dataset/m-p/840127#M332197</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-10-23T01:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter exponentiation values in sas dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-filter-exponentiation-values-in-sas-dataset/m-p/840129#M332198</link>
      <description>&lt;P&gt;You can just type in the value, just like you did in the assignment statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where a=6.7705698E14;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But the real value probably has more digits that what you are seeing.&lt;/P&gt;
&lt;P&gt;That looks like the output of the BEST12. format (which is what SAS normally uses when you haven't told it to use something else).&amp;nbsp; So of the 12 characters 3 are being used for the exponent and one for the decimal point so you only have 8 digits.&amp;nbsp; But 6 times 10 to the 14th power is 15 decimal digits.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;8    data test;
9      input @1 a @1 string $20. ;
10     string2=put(a,32.-L);
11     length = length(string);
12     length2 = length(string2);
13     format a 20.;
14     put (_all_) (=/);
15   cards;


a=677056980000000
string=6.7705698E14
string2=677056980000000
length=12
length2=15
&lt;/PRE&gt;
&lt;P&gt;So the real value might be any number in the range from&amp;nbsp;&lt;/P&gt;
&lt;P&gt;677,056,979,500,000 to&amp;nbsp;&lt;/P&gt;
&lt;P&gt;677,056,980,499,999&lt;/P&gt;</description>
      <pubDate>Sun, 23 Oct 2022 03:14:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-filter-exponentiation-values-in-sas-dataset/m-p/840129#M332198</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-10-23T03:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter exponentiation values in sas dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-filter-exponentiation-values-in-sas-dataset/m-p/840149#M332200</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19799"&gt;@1239&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If those numbers (in your &lt;EM&gt;real&lt;/EM&gt; data) are the results of calculations rather than hardcoded literals, checking exact equality ("&lt;FONT face="courier new,courier"&gt;if a=&lt;/FONT&gt; ...") is likely to fail. As&amp;nbsp;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159" target="_blank" rel="noopener"&gt;Tom&lt;/A&gt;&amp;nbsp;has pointed out, you would most probably miss relevant digits.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;1200  data _null_;
1201  a=exp(4.25769*exp(2.082));
1202  put a best12. / a best32.-L / a 18.1-L / a hex16.;
1203  if a ne 677056981379146 then put 'unequal';
1204  if a=677056981379145.9 then put 'OK 1a';
1205  if a=6.770569813791458E14 then put 'OK 1b';
1206  if put(a,hex16.)='43033E3CE6F1424F' then put 'OK 2';
1207  if round(a,1e7)=6.7705698e14 then put 'OK 3';
1208  if put(a,best12.)='6.7705698E14' then put 'OK 4';
1209  run;

6.7705698E14
677056981379146
677056981379146.0
43033E3CE6F1424F
unequal
OK 1a
OK 1b
OK 2
OK 3
OK 4&lt;/PRE&gt;
&lt;P&gt;So, there &lt;EM&gt;exist&lt;/EM&gt;&amp;nbsp;numeric literals for which exact equality holds (&lt;FONT face="courier new,courier"&gt;677056981379145.&lt;STRONG&gt;9&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;and &lt;FONT face="courier new,courier"&gt;6.77056981379145&lt;STRONG&gt;8&lt;/STRONG&gt;E14&lt;/FONT&gt;), but &lt;EM&gt;none&lt;/EM&gt; of the common numeric formats (&lt;EM&gt;w.d&lt;/EM&gt;, BEST&lt;EM&gt;w&lt;/EM&gt;., E&lt;EM&gt;w&lt;/EM&gt;., etc.) will show you sufficiently many digits so that you could type them.* Only special formats such as HEX16., BINARY64. or RB8. reveal the full binary content of a numeric variable, which is amenable to exact equality checks. Otherwise you need to resort to tests of only &lt;EM&gt;approximate&lt;/EM&gt; equality, either using numeric or character values (see the last two IF conditions above).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Knowing your data, you could abbreviate those approximate comparisons based on how close other values get to your target value. Each of the three IF or WHERE conditions below works for your sample data:&lt;/P&gt;
&lt;PRE&gt;put(a,best7.)='6.77E14'&lt;/PRE&gt;
&lt;PRE&gt;round(a,1e12)=6.77e14&lt;/PRE&gt;
&lt;PRE&gt;abs(a-6.7e14)&amp;lt;1e13&lt;/PRE&gt;
&lt;P&gt;&lt;FONT size="2"&gt;(&lt;EM&gt;In theory&lt;/EM&gt;, the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p0ifledavu3rv1n10gclzxbyy0ul.htm" target="_blank" rel="noopener"&gt;COMPFUZZ function&lt;/A&gt; should work as well.)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;* Edit: With the non-default setting &lt;FONT face="courier new,courier"&gt;options &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lesysoptsref/n130tap9xs8q36n14gq23sci5y52.htm" target="_blank" rel="noopener"&gt;decimalconv&lt;/A&gt;=&lt;STRONG&gt;stdieee&lt;/STRONG&gt;&lt;/FONT&gt; the 18.1 format &lt;EM&gt;does&lt;/EM&gt; show &lt;FONT face="courier new,courier"&gt;677056981379145.9&lt;/FONT&gt;.&lt;/P&gt;</description>
      <pubDate>Sun, 23 Oct 2022 14:07:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-filter-exponentiation-values-in-sas-dataset/m-p/840149#M332200</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2022-10-23T14:07:32Z</dc:date>
    </item>
  </channel>
</rss>

