<?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 Concat/cast function while using Impala in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Concat-cast-function-while-using-Impala/m-p/939144#M368796</link>
    <description>&lt;P&gt;Hello Experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm querying a DB in Hadoop and need to combine the date and time fields within the query itself. I will then use the combined field to join to another Hadoop table but I'm not able to use cast and concat correctly:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data available in DB:&lt;/P&gt;&lt;P&gt;Dt(string): 2024-06-14&lt;/P&gt;&lt;P&gt;Tm (string): 040507669747&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output that I'm trying to create:&lt;/P&gt;&lt;P&gt;Dat_time: 20240614040507669747&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My query:&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;connect to impala (dsn=abc user="&amp;amp;sysuserid." pw="&amp;amp;password.");&lt;/P&gt;&lt;P&gt;create table abc as (&lt;/P&gt;&lt;P&gt;select id, dt, tm,&lt;/P&gt;&lt;P&gt;concat(cast(date_format(dt,'yyyymmdd') as string), tm) as dat_time&amp;nbsp; /*I tried creating this from what I've learned so far but it's giving error*/&lt;/P&gt;&lt;P&gt;from DB);&lt;/P&gt;&lt;P&gt;disconnect from impala;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error: [Cloudera][Impala ODBC (370) Query analysis error occurred during query execution:&amp;nbsp; [HY000]: AnalysisException: default.date_format() unknown for database default. Currently this db has 0 functions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm unable to figure the correct syntax to make this happen. Would appreciate any guidance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Aug 2024 21:19:26 GMT</pubDate>
    <dc:creator>AJ16</dc:creator>
    <dc:date>2024-08-13T21:19:26Z</dc:date>
    <item>
      <title>Concat/cast function while using Impala</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concat-cast-function-while-using-Impala/m-p/939144#M368796</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm querying a DB in Hadoop and need to combine the date and time fields within the query itself. I will then use the combined field to join to another Hadoop table but I'm not able to use cast and concat correctly:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data available in DB:&lt;/P&gt;&lt;P&gt;Dt(string): 2024-06-14&lt;/P&gt;&lt;P&gt;Tm (string): 040507669747&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output that I'm trying to create:&lt;/P&gt;&lt;P&gt;Dat_time: 20240614040507669747&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My query:&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;connect to impala (dsn=abc user="&amp;amp;sysuserid." pw="&amp;amp;password.");&lt;/P&gt;&lt;P&gt;create table abc as (&lt;/P&gt;&lt;P&gt;select id, dt, tm,&lt;/P&gt;&lt;P&gt;concat(cast(date_format(dt,'yyyymmdd') as string), tm) as dat_time&amp;nbsp; /*I tried creating this from what I've learned so far but it's giving error*/&lt;/P&gt;&lt;P&gt;from DB);&lt;/P&gt;&lt;P&gt;disconnect from impala;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error: [Cloudera][Impala ODBC (370) Query analysis error occurred during query execution:&amp;nbsp; [HY000]: AnalysisException: default.date_format() unknown for database default. Currently this db has 0 functions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm unable to figure the correct syntax to make this happen. Would appreciate any guidance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 21:19:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concat-cast-function-while-using-Impala/m-p/939144#M368796</guid>
      <dc:creator>AJ16</dc:creator>
      <dc:date>2024-08-13T21:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: Concat/cast function while using Impala</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concat-cast-function-while-using-Impala/m-p/939153#M368800</link>
      <description>&lt;P&gt;I'd suggest doing the date and time conversion in SAS not Impala. Start with this which should handle the date:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
connect to impala (dsn=abc user="&amp;amp;sysuserid." pw="&amp;amp;password.");
create table abc as 
select  *
       ,input(dt, yymmdd10.) as SAS_Date format = date9.
from connection to impala 
(select id, dt, tm,
 from DB
);
disconnect from impala;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What does your time string represent? Is it hh:mm:ss like&amp;nbsp;&lt;SPAN&gt;04:05:07.669747 or something else?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2024 00:39:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concat-cast-function-while-using-Impala/m-p/939153#M368800</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2024-08-14T00:39:30Z</dc:date>
    </item>
  </channel>
</rss>

