<?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: Need help with Proc SQL Cast in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Need-help-with-Proc-SQL-Cast/m-p/861241#M340202</link>
    <description>Hi, I need it to be a numeric value because the RefNumber in the other table is numeric.</description>
    <pubDate>Mon, 27 Feb 2023 22:47:55 GMT</pubDate>
    <dc:creator>ChickenLittle</dc:creator>
    <dc:date>2023-02-27T22:47:55Z</dc:date>
    <item>
      <title>Need help with Proc SQL Cast</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-with-Proc-SQL-Cast/m-p/861237#M340198</link>
      <description>&lt;P&gt;Hi, I'm trying to convert a "RefNumber," which is a char, into an integer inside a Proc SQL statement. Is that possible? I am getting an error when I run the code below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc SQL;&lt;BR /&gt;Create Table Temp as&lt;BR /&gt;Select a.*,&lt;BR /&gt;cast(b.RefNumber as decimal(15,0)) as KeyRef&lt;BR /&gt;From TableA a &lt;BR /&gt;Left Join TableB b on a.KeyRef = b.KeyRef;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Error Message:&amp;nbsp;ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, ),&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2023 22:36:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-with-Proc-SQL-Cast/m-p/861237#M340198</guid>
      <dc:creator>ChickenLittle</dc:creator>
      <dc:date>2023-02-27T22:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Proc SQL Cast</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-with-Proc-SQL-Cast/m-p/861239#M340200</link>
      <description>&lt;P&gt;Why? If you aren't doing calculations on RefNumber leave it as character. Also CAST is not a valid function in SAS SQL. CAST is a function used in some external DBMS SQL implementations like Oracle.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2023 22:43:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-with-Proc-SQL-Cast/m-p/861239#M340200</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-02-27T22:43:02Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Proc SQL Cast</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-with-Proc-SQL-Cast/m-p/861240#M340201</link>
      <description>&lt;P&gt;From now on, when you get an error in the log, show us the ENTIRE log for that PROC or DATA step. DO not show us small portions of the log, we need to see the ENTIRE log for that PROC or DATA step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc SQL;
    Create Table Temp as
    Select a.*,
    b.KeyRef as keyref2
    From TableA a
    Left Join TableB b on put(a.KeyRef,15.0) = b.KeyRef;
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, 27 Feb 2023 22:49:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-with-Proc-SQL-Cast/m-p/861240#M340201</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-27T22:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Proc SQL Cast</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-with-Proc-SQL-Cast/m-p/861241#M340202</link>
      <description>Hi, I need it to be a numeric value because the RefNumber in the other table is numeric.</description>
      <pubDate>Mon, 27 Feb 2023 22:47:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-with-Proc-SQL-Cast/m-p/861241#M340202</guid>
      <dc:creator>ChickenLittle</dc:creator>
      <dc:date>2023-02-27T22:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Proc SQL Cast</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-with-Proc-SQL-Cast/m-p/861242#M340203</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/436300"&gt;@ChickenLittle&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Hi, I need it to be a numeric value because the RefNumber in the other table is numeric.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Actually this is backwards. You need to convert the numeric version in the other table to character.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2023 22:48:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-with-Proc-SQL-Cast/m-p/861242#M340203</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-27T22:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Proc SQL Cast</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-with-Proc-SQL-Cast/m-p/861243#M340204</link>
      <description>Thanks so much!</description>
      <pubDate>Mon, 27 Feb 2023 22:50:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-with-Proc-SQL-Cast/m-p/861243#M340204</guid>
      <dc:creator>ChickenLittle</dc:creator>
      <dc:date>2023-02-27T22:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Proc SQL Cast</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-with-Proc-SQL-Cast/m-p/861245#M340205</link>
      <description>Yup, I got that part, I just needed the "input(...)" statement to realize what I needed, thanks so much!</description>
      <pubDate>Mon, 27 Feb 2023 23:01:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-with-Proc-SQL-Cast/m-p/861245#M340205</guid>
      <dc:creator>ChickenLittle</dc:creator>
      <dc:date>2023-02-27T23:01:08Z</dc:date>
    </item>
  </channel>
</rss>

