<?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 remove rows with non-numeric characters in a column? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-rows-with-non-numeric-characters-in-a-column/m-p/793236#M254209</link>
    <description>&lt;P&gt;Why remove them? Why not just convert the values into a number and that then values that are invalid as a number will have missing values and be ignored when calculating means and other statistics.&lt;/P&gt;
&lt;P&gt;The ?? will suppress the errors when invalid strings are found. 32 is the maximum width the normal numeric informat supports. The INPUT() function does not care if the string being converted is shorter than the width used in the INFORMAT being used to convert it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  rate_n = input(rate,??32.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 28 Jan 2022 22:41:13 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-01-28T22:41:13Z</dc:date>
    <item>
      <title>How to remove rows with non-numeric characters in a column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-rows-with-non-numeric-characters-in-a-column/m-p/793174#M254180</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to find an easy way to remove rows with non-numeric values in a column.&lt;/P&gt;&lt;P&gt;I only have to write the code in PROC SQL and there are non-English characters in the values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[Current data] - real codes have a lot of rows..&lt;/P&gt;&lt;P&gt;custNo, rate&lt;/P&gt;&lt;P&gt;1000&amp;nbsp; &amp;nbsp; 0.6&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1002　 0.6&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1004　 0.8&lt;/P&gt;&lt;P&gt;1005　 確認要&lt;/P&gt;&lt;P&gt;1007　 案内通り&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[Result Data]&lt;/P&gt;&lt;P&gt;custNo, rate&lt;/P&gt;&lt;P&gt;1000&amp;nbsp; &amp;nbsp; 0.6&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1002　 0.6&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1004　 0.8&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to delete rows with non-numeric values in the rate column,&lt;/P&gt;&lt;P&gt;cuz I have to convert values in the "rate" to numeric values for making a formula.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I get an answer, I will appreciate it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 18:17:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-rows-with-non-numeric-characters-in-a-column/m-p/793174#M254180</guid>
      <dc:creator>seohyeonjeong</dc:creator>
      <dc:date>2022-01-28T18:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove rows with non-numeric characters in a column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-rows-with-non-numeric-characters-in-a-column/m-p/793185#M254187</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    create table want as select * from have
    where not missing(input(rate,best10.));
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Jan 2022 18:46:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-rows-with-non-numeric-characters-in-a-column/m-p/793185#M254187</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-01-28T18:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove rows with non-numeric characters in a column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-rows-with-non-numeric-characters-in-a-column/m-p/793234#M254207</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/385687"&gt;@seohyeonjeong&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The below code uses the &lt;FONT face="courier new,courier"&gt;kcompress()&lt;/FONT&gt; function to remove any "-", "." and digits ("d") in the variable rate, and if there is nothing left then the record is output. This obviously assumes you don't have any invalid rates values such as "---", or ".....", or "-.-.-", etc.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
	create table want as
	select *
	from have
	where kcompress(rate, '-.','d') is missing
	;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you choose to use the &lt;FONT face="courier new,courier"&gt;input()&lt;/FONT&gt; function (as per&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;'s post) then I recommend you use the "?" modifier as per the &lt;A title="https://documentation.sas.com/doc/en/pgmsascdc/v_022/lefunctionsref/p19en16vskd2vhn1vwmxpxnglxxs.htm" href="https://documentation.sas.com/doc/en/pgmsascdc/v_022/lefunctionsref/p19en16vskd2vhn1vwmxpxnglxxs.htm" target="_blank" rel="noopener"&gt;documentation&lt;/A&gt;, for example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    create table want as select * from have
    where not missing(input(c_height,? best10.));
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;
&lt;P&gt;Amir.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Edit&lt;/STRONG&gt;: Replaced references to &lt;FONT face="courier new,courier"&gt;compress()&lt;/FONT&gt; with &lt;FONT face="courier new,courier"&gt;kcompress()&lt;/FONT&gt;, as per post from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;.&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jan 2022 20:22:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-rows-with-non-numeric-characters-in-a-column/m-p/793234#M254207</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2022-01-29T20:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove rows with non-numeric characters in a column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-rows-with-non-numeric-characters-in-a-column/m-p/793236#M254209</link>
      <description>&lt;P&gt;Why remove them? Why not just convert the values into a number and that then values that are invalid as a number will have missing values and be ignored when calculating means and other statistics.&lt;/P&gt;
&lt;P&gt;The ?? will suppress the errors when invalid strings are found. 32 is the maximum width the normal numeric informat supports. The INPUT() function does not care if the string being converted is shorter than the width used in the INFORMAT being used to convert it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  rate_n = input(rate,??32.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Jan 2022 22:41:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-rows-with-non-numeric-characters-in-a-column/m-p/793236#M254209</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-01-28T22:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove rows with non-numeric characters in a column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-rows-with-non-numeric-characters-in-a-column/m-p/793248#M254219</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/22588"&gt;@Amir&lt;/a&gt;&amp;nbsp;You need to use kcompress() and not compress() with MBCS data or the results can become "unexpected".&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jan 2022 02:47:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-rows-with-non-numeric-characters-in-a-column/m-p/793248#M254219</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-01-29T02:47:54Z</dc:date>
    </item>
  </channel>
</rss>

