<?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 Create a Hive table with SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Hive-table-with-SAS/m-p/817367#M322643</link>
    <description>&lt;P&gt;We're converting from SAS to PySpark, &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp; which is why I haven't been around much lately.&amp;nbsp; I'm trying to create a Hive table using SAS 9.4 M6 running on a "Windows 2016 Standard" (64 bit) server.&amp;nbsp; My version of Hive is the MapR implementation, version&amp;nbsp;Hive 2.3.6-mapr-1912-r13.&amp;nbsp; I'm running Hive in an RHEL 8.5 environment.&amp;nbsp;&amp;nbsp;I &lt;EM&gt;only&lt;/EM&gt; have an &lt;STRONG&gt;ODBC&lt;/STRONG&gt; driver available to me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My code is pretty straightforward:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;LIBNAME	OPSIdflt	ODBC	SCHEMA=default				NOPROMPT="&amp;amp;CnxOPSIrsc";

OPTIONS	DBIDIRECTEXEC	=	YES;
%DelDS(OPSIDFLT.Cars_Test);
PROC	SQL;
	CREATE	TABLE	OPSIDFLT.Cars_Test	AS	
		SELECT	*	FROM	SASHELP.Cars;
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;I've tried the above code with and without the DBIDIRECTEXEC option, but neither works.&amp;nbsp; See trace and error information, below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ODBC_33: Prepared: on connection 4
SELECT * FROM default.CARS_Test WHERE 0=1 
 
 
Summary Statistics for ODBC are:
Total SQL prepare seconds were:                     0.007943
Total seconds used by the ODBC ACCESS engine were     0.008045
 
ODBC: AUTOCOMMIT is YES for connection 5
NOTE: SAS variable labels, formats, and lengths are not written to DBMS tables.
 
ODBC_34: Executed: on connection 5
CREATE TABLE default.CARS_Test (Make VARCHAR(13),Model VARCHAR(40),Type VARCHAR(8),Origin VARCHAR(6),DriveTrain 
VARCHAR(5),MSRP DOUBLE,Invoice DOUBLE,EngineSize DOUBLE,Cylinders DOUBLE,Horsepower DOUBLE,MPG_City DOUBLE,MPG_Highway 
DOUBLE,Weight DOUBLE,Wheelbase DOUBLE,Length DOUBLE)
 
 
ODBC_35: Prepared: on connection 5
INSERT INTO default.CARS_Test 
(Make,Model,Type,Origin,DriveTrain,MSRP,Invoice,EngineSize,Cylinders,Horsepower,MPG_City,MPG_Highway,Weight,Wheelbase,Length)
  VALUES ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? )
 
 
ODBC_36: Executed: on connection 5
Prepared statement ODBC_35
 
ERROR: CLI execute error: [MapR][HiveODBC] (80) Syntax or semantic analysis error thrown in server while execurint query. 
       Error message from server: Error while compiling statement: FAILED: ParseException line 1:164 cannot recognize input 
       near '?' ',' '?' in expression specification
 
Summary Statistics for ODBC are:
Total SQL execution seconds were:                   0.463769
Total SQL prepare seconds were:                     0.008294
Total seconds used by the ODBC ACCESS engine were     0.473198&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regarding my effort to create a table in Hive using SAS:&amp;nbsp; The create seems to go OK, but the insert appears to be failing.&amp;nbsp; Presumably the question marks in the above log excerpt should be filled in by data pulled from SAShelp.Cars, but something isn't working right.&amp;nbsp;I can create tables in our Hive environment with my ID using PySpark, so I believe I have the proper permissions. I can query data using the above Libname, so I don't think there's an issue with the Libname.&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;Do you have any suggestions?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
    <pubDate>Thu, 09 Jun 2022 22:21:39 GMT</pubDate>
    <dc:creator>jimbarbour</dc:creator>
    <dc:date>2022-06-09T22:21:39Z</dc:date>
    <item>
      <title>Create a Hive table with SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Hive-table-with-SAS/m-p/817367#M322643</link>
      <description>&lt;P&gt;We're converting from SAS to PySpark, &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp; which is why I haven't been around much lately.&amp;nbsp; I'm trying to create a Hive table using SAS 9.4 M6 running on a "Windows 2016 Standard" (64 bit) server.&amp;nbsp; My version of Hive is the MapR implementation, version&amp;nbsp;Hive 2.3.6-mapr-1912-r13.&amp;nbsp; I'm running Hive in an RHEL 8.5 environment.&amp;nbsp;&amp;nbsp;I &lt;EM&gt;only&lt;/EM&gt; have an &lt;STRONG&gt;ODBC&lt;/STRONG&gt; driver available to me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My code is pretty straightforward:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;LIBNAME	OPSIdflt	ODBC	SCHEMA=default				NOPROMPT="&amp;amp;CnxOPSIrsc";

OPTIONS	DBIDIRECTEXEC	=	YES;
%DelDS(OPSIDFLT.Cars_Test);
PROC	SQL;
	CREATE	TABLE	OPSIDFLT.Cars_Test	AS	
		SELECT	*	FROM	SASHELP.Cars;
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;I've tried the above code with and without the DBIDIRECTEXEC option, but neither works.&amp;nbsp; See trace and error information, below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ODBC_33: Prepared: on connection 4
SELECT * FROM default.CARS_Test WHERE 0=1 
 
 
Summary Statistics for ODBC are:
Total SQL prepare seconds were:                     0.007943
Total seconds used by the ODBC ACCESS engine were     0.008045
 
ODBC: AUTOCOMMIT is YES for connection 5
NOTE: SAS variable labels, formats, and lengths are not written to DBMS tables.
 
ODBC_34: Executed: on connection 5
CREATE TABLE default.CARS_Test (Make VARCHAR(13),Model VARCHAR(40),Type VARCHAR(8),Origin VARCHAR(6),DriveTrain 
VARCHAR(5),MSRP DOUBLE,Invoice DOUBLE,EngineSize DOUBLE,Cylinders DOUBLE,Horsepower DOUBLE,MPG_City DOUBLE,MPG_Highway 
DOUBLE,Weight DOUBLE,Wheelbase DOUBLE,Length DOUBLE)
 
 
ODBC_35: Prepared: on connection 5
INSERT INTO default.CARS_Test 
(Make,Model,Type,Origin,DriveTrain,MSRP,Invoice,EngineSize,Cylinders,Horsepower,MPG_City,MPG_Highway,Weight,Wheelbase,Length)
  VALUES ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? )
 
 
ODBC_36: Executed: on connection 5
Prepared statement ODBC_35
 
ERROR: CLI execute error: [MapR][HiveODBC] (80) Syntax or semantic analysis error thrown in server while execurint query. 
       Error message from server: Error while compiling statement: FAILED: ParseException line 1:164 cannot recognize input 
       near '?' ',' '?' in expression specification
 
Summary Statistics for ODBC are:
Total SQL execution seconds were:                   0.463769
Total SQL prepare seconds were:                     0.008294
Total seconds used by the ODBC ACCESS engine were     0.473198&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regarding my effort to create a table in Hive using SAS:&amp;nbsp; The create seems to go OK, but the insert appears to be failing.&amp;nbsp; Presumably the question marks in the above log excerpt should be filled in by data pulled from SAShelp.Cars, but something isn't working right.&amp;nbsp;I can create tables in our Hive environment with my ID using PySpark, so I believe I have the proper permissions. I can query data using the above Libname, so I don't think there's an issue with the Libname.&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;Do you have any suggestions?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2022 22:21:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-Hive-table-with-SAS/m-p/817367#M322643</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2022-06-09T22:21:39Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Hive table with SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Hive-table-with-SAS/m-p/817401#M322656</link>
      <description>&lt;P&gt;Very long shot, but try proc append see if the generated code is different?&lt;/P&gt;
&lt;P&gt;I wonder if the values are corrupted by SAS of by the ODBC driver. I'd lean toward the latter since SAS can do that fine with other access methods?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2022 03:50:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-Hive-table-with-SAS/m-p/817401#M322656</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2022-06-10T03:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Hive table with SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Hive-table-with-SAS/m-p/817412#M322660</link>
      <description>&lt;P&gt;Hello, Chris,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for that idea.&amp;nbsp; Unfortunately, I get the same result.&amp;nbsp; It may well be, as you suggest, an ODBC driver issue (I wouldn't be surprised at all), but I have no idea how to address such a thing assuming that it is so.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can see that my original Proc SQL did in fact create the table.&amp;nbsp; If I use validvarname=V7, then SAS -- or more likely the driver -- prefixes the column names with the table name.&amp;nbsp; If I use validvarname=ANY, then SAS (or the driver) wants to use a name literal with again the table name as a part of the column name.&amp;nbsp; I'm suspicious that this may be what is screwing up the works.&amp;nbsp; &amp;nbsp;This most likely implicates the driver.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jimbarbour_0-1654845068577.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/72116i6F97944ADA332FBD/image-size/large?v=v2&amp;amp;px=999" role="button" title="jimbarbour_0-1654845068577.png" alt="jimbarbour_0-1654845068577.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P.S.&amp;nbsp;&amp;nbsp;I also tried Proc FedSQL, but got a "Feature not supported" error (see below).&amp;nbsp; Have I got a syntax error or something?&amp;nbsp; Or can I literally not run a CTAS type query?&lt;/P&gt;
&lt;PRE&gt;NOTE: Connection string:
NOTE: DRIVER=FEDSQL;CONOPTS= ( ( (DRIVER=ODBC;CONOPTS= 
   (DSN=OPSIRSC;AUTHMECH=3;HOST=rp000056703;PORT=10846;PWD=*;SCHEMA=default;UID=*);CATALOG=OPSIDFLT;SCHEMA=default)
      ); (DRIVER=BASE;CATALOG=WORK;SCHEMA= (NAME=WORK;PRIMARYPATH={X:\saswork\jbarbour\_TD44996_APSWP2335_\Prc2})); 
      (DRIVER=BASE;CATALOG=SASUSER;SCHEMA= (NAME=SASUSER;PRIMARYPATH={X:\sasuser\jbarbour})))
60         	CREATE	TABLE	OPSIDFLT.Cars_Test	AS	
61         		SELECT	*	FROM	WORK.Cars_Test;
ERROR: Feature not supported
NOTE: PROC FEDSQL has set option NOEXEC and will continue to prepare statements.&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2022 07:15:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-Hive-table-with-SAS/m-p/817412#M322660</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2022-06-10T07:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Hive table with SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Hive-table-with-SAS/m-p/834300#M329866</link>
      <description>&lt;P&gt;Hi Jim,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Were you able to get this resolved and working?&lt;/P&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;</description>
      <pubDate>Tue, 20 Sep 2022 15:41:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-Hive-table-with-SAS/m-p/834300#M329866</guid>
      <dc:creator>SAS_ACE</dc:creator>
      <dc:date>2022-09-20T15:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Hive table with SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-Hive-table-with-SAS/m-p/842416#M333111</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/227735"&gt;@SAS_ACE&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for asking.&amp;nbsp; Sorry to get back to you so late.&amp;nbsp; I sort of gave up hope and haven't been checking SAS Communities because they're doing away with SAS in my group at work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I never did find a way to create and populate the tables using SAS.&amp;nbsp; What I did was a work-around.&amp;nbsp; I exported to a tab delimited dataset and then wrote a PySpark program to read the tab delimited and create a Hive table with that data.&amp;nbsp; A bit kludgey, but it does work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 22:15:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-Hive-table-with-SAS/m-p/842416#M333111</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2022-11-03T22:15:43Z</dc:date>
    </item>
  </channel>
</rss>

