<?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 SAS Character to Numeric for ALPHA Numeric Column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Character-to-Numeric-for-ALPHA-Numeric-Column/m-p/816690#M322380</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Please review the code below.&lt;/P&gt;&lt;P&gt;For all the ALPHABETS in the column &lt;STRONG&gt;have_column&amp;nbsp;&lt;/STRONG&gt;I get below warning.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WARNING: INPUT function reported 'WARNING: Illegal first argument to function' while processing WHERE clause.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please advise as to how can I avoid this warning.&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=""&gt;/*There is an empty first row*/
data have;
input have_column $5.;
datalines;
  
00
02
06
08
10
24
29
30
39
NA
AB
CD
;RUN;

proc sql;
create table want as
select
have_column
from have
where input(have_column,best.)&amp;gt;=20
;quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 06 Jun 2022 17:53:11 GMT</pubDate>
    <dc:creator>david27</dc:creator>
    <dc:date>2022-06-06T17:53:11Z</dc:date>
    <item>
      <title>SAS Character to Numeric for ALPHA Numeric Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Character-to-Numeric-for-ALPHA-Numeric-Column/m-p/816690#M322380</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Please review the code below.&lt;/P&gt;&lt;P&gt;For all the ALPHABETS in the column &lt;STRONG&gt;have_column&amp;nbsp;&lt;/STRONG&gt;I get below warning.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WARNING: INPUT function reported 'WARNING: Illegal first argument to function' while processing WHERE clause.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please advise as to how can I avoid this warning.&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=""&gt;/*There is an empty first row*/
data have;
input have_column $5.;
datalines;
  
00
02
06
08
10
24
29
30
39
NA
AB
CD
;RUN;

proc sql;
create table want as
select
have_column
from have
where input(have_column,best.)&amp;gt;=20
;quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2022 17:53:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Character-to-Numeric-for-ALPHA-Numeric-Column/m-p/816690#M322380</guid>
      <dc:creator>david27</dc:creator>
      <dc:date>2022-06-06T17:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Character to Numeric for ALPHA Numeric Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Character-to-Numeric-for-ALPHA-Numeric-Column/m-p/816691#M322381</link>
      <description>&lt;P&gt;What is it you want it to do when the character variable's value does not look like a character representation of a number?&amp;nbsp; Note that SAS will treat numeric missing values as less than any actual number.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are trying to test if the string starts with characters like '21' or '3' or 'A' or 'b' that sort after the characters '20' then just do that:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where have_column &amp;gt; '20'&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If are you trying to convert the string into a number and then test if it is larger than twenty you&amp;nbsp;can use the ? modifier to the informat specification to suppress the notes.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where input(have_column,?32.)&amp;gt;=20&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTE: BEST is the name of a FORMAT that tries to figure out the best way to display a number within the width specified.&amp;nbsp; The concept does not make any sense for an INFORMAT as there is only one way to store any particular number, no matter how it is represented in the string being converted.&amp;nbsp; If you use BEST as an informat SAS will just use the regular numeric infomat in its place.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2022 18:06:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Character-to-Numeric-for-ALPHA-Numeric-Column/m-p/816691#M322381</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-06T18:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Character to Numeric for ALPHA Numeric Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Character-to-Numeric-for-ALPHA-Numeric-Column/m-p/816692#M322382</link>
      <description>&lt;P&gt;You can avoid the WARNINGs in the log by&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
have_column
from have
where input(have_column,? best.)&amp;gt;=20
;quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Jun 2022 18:05:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Character-to-Numeric-for-ALPHA-Numeric-Column/m-p/816692#M322382</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-06-06T18:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Character to Numeric for ALPHA Numeric Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Character-to-Numeric-for-ALPHA-Numeric-Column/m-p/816693#M322383</link>
      <description>Thank You &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;.&lt;BR /&gt;&lt;BR /&gt;I am trying to convert the string into a number and then test if it is larger than twenty.&lt;BR /&gt;This solves the problem.</description>
      <pubDate>Mon, 06 Jun 2022 18:06:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Character-to-Numeric-for-ALPHA-Numeric-Column/m-p/816693#M322383</guid>
      <dc:creator>david27</dc:creator>
      <dc:date>2022-06-06T18:06:53Z</dc:date>
    </item>
  </channel>
</rss>

