<?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: Converting Char to Num in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Converting-Char-to-Num/m-p/343358#M78818</link>
    <description>&lt;P&gt;It looks like you are doing this with SQL so are you attempting to use the numeric value in a comparison or &amp;nbsp;create a new variable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Comparison&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where input(t1.count,4.) = 245&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;where input(t1.count,4.) = b.numericvariable&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;new variable&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Select input(t1.count,4.) as Count&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As written you are comparing the current character value to the converted numeric and that is what generates an error.&lt;/P&gt;
&lt;P&gt;More information about what you attempting to do may be needed.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Mar 2017 15:53:27 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-03-22T15:53:27Z</dc:date>
    <item>
      <title>Converting Char to Num</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Char-to-Num/m-p/343345#M78816</link>
      <description>&lt;P&gt;I have the following code&lt;/P&gt;&lt;P&gt;t1.Count =input(t1.Count, 4.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;trying to convert char to number but I am getting following error&amp;nbsp; any idea&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: Expression using equals (=) has components that are of different data types.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 15:40:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Char-to-Num/m-p/343345#M78816</guid>
      <dc:creator>Davar</dc:creator>
      <dc:date>2017-03-22T15:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Char to Num</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Char-to-Num/m-p/343358#M78818</link>
      <description>&lt;P&gt;It looks like you are doing this with SQL so are you attempting to use the numeric value in a comparison or &amp;nbsp;create a new variable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Comparison&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where input(t1.count,4.) = 245&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;where input(t1.count,4.) = b.numericvariable&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;new variable&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Select input(t1.count,4.) as Count&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As written you are comparing the current character value to the converted numeric and that is what generates an error.&lt;/P&gt;
&lt;P&gt;More information about what you attempting to do may be needed.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 15:53:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Char-to-Num/m-p/343358#M78818</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-03-22T15:53:27Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Char to Num</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Char-to-Num/m-p/343404#M78834</link>
      <description>&lt;P&gt;This is what I am trying to do T1.Count1 is a char value and I am trying to convert to Num.&lt;/P&gt;&lt;P&gt;I thought if I assign the new name count can work as show below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;CREATE&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;TABLE&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; AUTO.QUERY_FOR_BUS_DAY &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;AS&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;SELECT&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; t1.'Active_Messages'n, &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;t1.'Total_Active_Messages'n,&lt;/P&gt;&lt;P&gt;t1.Aging,&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Count =input(t1.Count1, &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;4.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;),&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;t1.'Age_Date'n,&lt;/P&gt;&lt;P&gt;t1.'Report_Date'n,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 16:50:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Char-to-Num/m-p/343404#M78834</guid>
      <dc:creator>Davar</dc:creator>
      <dc:date>2017-03-22T16:50:16Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Char to Num</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Char-to-Num/m-p/343420#M78839</link>
      <description>&lt;P&gt;I think the syntax for this would be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;input(t1.Count1, 4.) as Count,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 17:15:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Char-to-Num/m-p/343420#M78839</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-03-22T17:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Char to Num</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Char-to-Num/m-p/343422#M78841</link>
      <description>Thank you&lt;BR /&gt;</description>
      <pubDate>Wed, 22 Mar 2017 17:22:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Char-to-Num/m-p/343422#M78841</guid>
      <dc:creator>Davar</dc:creator>
      <dc:date>2017-03-22T17:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Char to Num</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Char-to-Num/m-p/343440#M78846</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/35797"&gt;@Davar&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;This is what I am trying to do T1.Count1 is a char value and I am trying to convert to Num.&lt;/P&gt;
&lt;P&gt;I thought if I assign the new name count can work as show below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;CREATE&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;TABLE&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; AUTO.QUERY_FOR_BUS_DAY &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;AS&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;SELECT&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; t1.'Active_Messages'n, &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;t1.'Total_Active_Messages'n,&lt;/P&gt;
&lt;P&gt;t1.Aging,&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Count =input(t1.Count1, &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;4.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;),&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;t1.'Age_Date'n,&lt;/P&gt;
&lt;P&gt;t1.'Report_Date'n,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Using a = like that in a select creates a boolean (true/false 1/0 valued) un-named variable that SAS will assign a name for.&lt;/P&gt;
&lt;P&gt;Please see this example:&lt;/P&gt;
&lt;PRE&gt;data have;
  input x;
datalines;
1
2
;
run;

proc sql;
  create table result as
  select x, x=1
  from have;
quit;&lt;/PRE&gt;
&lt;P&gt;When I ran that on my install I get a variable name _TEMA001, YMMV.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 17:57:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Char-to-Num/m-p/343440#M78846</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-03-22T17:57:07Z</dc:date>
    </item>
  </channel>
</rss>

