<?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: SAS/Access columns could have a length in SAS of 32767 extract 0 rows in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-Access-columns-could-have-a-length-in-SAS-of-32767-extract-0/m-p/628446#M18852</link>
    <description>&lt;P&gt;To&amp;nbsp; get to the bottom of this I'd start with a row count of your source tables. Something like below:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select * from connection to cen20
(select count(*) as cnt from deno3);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you've got rows in your source table then I'd try to create the temporary tables with the correct column attributes right from start.&lt;/P&gt;
&lt;P&gt;I'm not sure if below syntax is correct but I'm pretty sure that Hive SQL will allow you to define the column types in the query.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;execute 
  (
    create temporary table deno4 as
      select 
        name as name varchar(50),
         CASE
            WHEN STATEFP &amp;lt;&amp;gt; '' THEN STATEFP
            ELSE 'missing'
         END STATEFP varchar(10)
      from deno3
  ) 
  by serv20;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then may-be issue another select count(*) against the temporary table you've just created to check if you'll get actually data into SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure how your connect statement looks like but may-be investigate how option &lt;A href="https://go.documentation.sas.com/?docsetId=acreldb&amp;amp;docsetTarget=n166tqlopg9p0bn1okz4ilmde7mp.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;CONNECTION&lt;/A&gt; influences what you get.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And just as a side note:&lt;/P&gt;
&lt;P&gt;I'm personally moving more and more to defining database connections via the Libname statement and then for explicit pass-through SQL I'm using syntax: CONNECTION USING &amp;lt;libref&amp;gt; .&lt;/P&gt;</description>
    <pubDate>Sat, 29 Feb 2020 15:12:51 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2020-02-29T15:12:51Z</dc:date>
    <item>
      <title>SAS/Access columns could have a length in SAS of 32767 extract 0 rows</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-Access-columns-could-have-a-length-in-SAS-of-32767-extract-0/m-p/628308#M18849</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When executing code on Hive within a SAS environment, I ran into trouble extracting hive table to SAS server.&lt;/P&gt;&lt;P&gt;Before altering the variable format to varchar, I received the following warning message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;WARNING: The following columns could have a length in SAS of 32767. If so, SAS performance is impacted. See SAS/ACCESS&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;documentation for details.&amp;nbsp; The columns read from Hive followed by the maximum length observed were:&amp;nbsp; name:0,&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;bcustatefp:0, bcucountyfp:0&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Because of this warning, I extracted 0 rows and only the column names from hive to SAS server. I learned from google that I should alter column format to charvar to fix the warning, but after the change I still extracted 0 rows with just the column names when there is clearly data in the extracted table. ( I was able to extract the tables with the same exact code on another server on the copied dataset)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Log:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&lt;DIV class="sasSource"&gt;261 create table work.deno1 as&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;262 select * from connection to serv20&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;263 (select * from deno4);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;HADOOP_212: Prepared: on connection 1&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;select * from deno4&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Table WORK.DENO1 created, with 0 rows and 7 columns.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;264&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;265 create table work.num1 as&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;266 select * from connection to serv20&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;267 (select * from num3);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;HADOOP_213: Prepared: on connection 1&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;select * from num3&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Table WORK.NUM1 created, with 0 rows and 7 columns.&lt;/DIV&gt;&lt;/DIV&gt;&lt;PRE class="sasLog"&gt;&amp;nbsp;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Part of my code that generated variables that do not match SAS server format:&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=" language-sas"&gt;execute (create temporary table deno4 as
select name, nifi_date,
   CASE
      WHEN STATEFP &amp;lt;&amp;gt; '' THEN STATEFP
      ELSE 'missing'
   END STATEFP,
   CASE
      WHEN COUNTYFP &amp;lt;&amp;gt; '' THEN COUNTYFP
      ELSE 'missing'
   END COUNTYFP,
sum(count(*)) over (partition by nifi_date,name) as freq_all_deno,
sum(count(name)) over (partition by nifi_date, name, STATEFP) as freq_state_deno,
count(name) as freq_county_deno

   from deno3
   group by nifi_date, name,STATEFP, COUNTYFP
) by serv20;


execute (alter table deno4 CHANGE name name varchar(50)) by serv20;
execute (alter table deno4 CHANGE STATEFP STATEFP varchar(10)) by serv20;
execute (alter table deno4 CHANGE COUNTYFP COUNTYFP varchar(10)) by serv20;


execute (create temporary table num3 as
select name, nifi_date,
   CASE
      WHEN STATEFP &amp;lt;&amp;gt; '' THEN STATEFP
      ELSE 'missing'
   END STATEFP,
   CASE
      WHEN COUNTYFP &amp;lt;&amp;gt; '' THEN COUNTYFP
      ELSE 'missing'
   END COUNTYFP,
sum(count(*)) over (partition by nifi_date,name) as freq_all_num,
sum(count(name)) over (partition by nifi_date,name,STATEFP) as freq_state_num,
count(name) as freq_county_num
   from num2
   group by nifi_date, name,STATEFP, COUNTYFP
) by serv20;


execute (alter table num3 CHANGE name name varchar(50)) by serv20;
execute (alter table num3 CHANGE STATEFP STATEFP varchar(10)) by serv20;
execute (alter table num3 CHANGE COUNTYFP COUNTYFP varchar(10)) by serv20;

create table work.deno1 as
select * from connection to cen20
(select * from deno4);

create table work.num1 as
select * from connection to cen20
(select * from num3);




&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2020 19:30:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-Access-columns-could-have-a-length-in-SAS-of-32767-extract-0/m-p/628308#M18849</guid>
      <dc:creator>lydiawawa</dc:creator>
      <dc:date>2020-02-28T19:30:18Z</dc:date>
    </item>
    <item>
      <title>Re: SAS/Access columns could have a length in SAS of 32767 extract 0 rows</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-Access-columns-could-have-a-length-in-SAS-of-32767-extract-0/m-p/628446#M18852</link>
      <description>&lt;P&gt;To&amp;nbsp; get to the bottom of this I'd start with a row count of your source tables. Something like below:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select * from connection to cen20
(select count(*) as cnt from deno3);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you've got rows in your source table then I'd try to create the temporary tables with the correct column attributes right from start.&lt;/P&gt;
&lt;P&gt;I'm not sure if below syntax is correct but I'm pretty sure that Hive SQL will allow you to define the column types in the query.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;execute 
  (
    create temporary table deno4 as
      select 
        name as name varchar(50),
         CASE
            WHEN STATEFP &amp;lt;&amp;gt; '' THEN STATEFP
            ELSE 'missing'
         END STATEFP varchar(10)
      from deno3
  ) 
  by serv20;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then may-be issue another select count(*) against the temporary table you've just created to check if you'll get actually data into SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure how your connect statement looks like but may-be investigate how option &lt;A href="https://go.documentation.sas.com/?docsetId=acreldb&amp;amp;docsetTarget=n166tqlopg9p0bn1okz4ilmde7mp.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;CONNECTION&lt;/A&gt; influences what you get.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And just as a side note:&lt;/P&gt;
&lt;P&gt;I'm personally moving more and more to defining database connections via the Libname statement and then for explicit pass-through SQL I'm using syntax: CONNECTION USING &amp;lt;libref&amp;gt; .&lt;/P&gt;</description>
      <pubDate>Sat, 29 Feb 2020 15:12:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-Access-columns-could-have-a-length-in-SAS-of-32767-extract-0/m-p/628446#M18852</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-02-29T15:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: SAS/Access columns could have a length in SAS of 32767 extract 0 rows</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-Access-columns-could-have-a-length-in-SAS-of-32767-extract-0/m-p/628466#M18853</link>
      <description>thank you so so so much. I will test it out on Monday. This is life-saving.</description>
      <pubDate>Sat, 29 Feb 2020 18:47:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-Access-columns-could-have-a-length-in-SAS-of-32767-extract-0/m-p/628466#M18853</guid>
      <dc:creator>lydiawawa</dc:creator>
      <dc:date>2020-02-29T18:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: SAS/Access columns could have a length in SAS of 32767 extract 0 rows</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-Access-columns-could-have-a-length-in-SAS-of-32767-extract-0/m-p/628800#M18854</link>
      <description>The syntex do have error. It is saying ERROR missing EOF at name varchar. Maybe adding the alter statement for each string variable is the only solution?</description>
      <pubDate>Mon, 02 Mar 2020 15:47:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-Access-columns-could-have-a-length-in-SAS-of-32767-extract-0/m-p/628800#M18854</guid>
      <dc:creator>lydiawawa</dc:creator>
      <dc:date>2020-03-02T15:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: SAS/Access columns could have a length in SAS of 32767 extract 0 rows</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-Access-columns-could-have-a-length-in-SAS-of-32767-extract-0/m-p/628812#M18855</link>
      <description>the count statement also generated an error:&lt;BR /&gt;&lt;BR /&gt;ERROR: Prepare error: org.apache.thrift.transport.TTransportException: HTTP Response code: 500&lt;BR /&gt;SQL statement: select count(*) as cnt from deno3</description>
      <pubDate>Mon, 02 Mar 2020 16:03:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-Access-columns-could-have-a-length-in-SAS-of-32767-extract-0/m-p/628812#M18855</guid>
      <dc:creator>lydiawawa</dc:creator>
      <dc:date>2020-03-02T16:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: SAS/Access columns could have a length in SAS of 32767 extract 0 rows</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-Access-columns-could-have-a-length-in-SAS-of-32767-extract-0/m-p/628823#M18856</link>
      <description>&lt;P&gt;Hi!&amp;nbsp; I'm not sure this will answer your specific question, but it may offer an alternate path if all you are trying to do is read STRING formatted column data in Hive with SAS...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Suggestion:&lt;/STRONG&gt; &lt;/U&gt;&lt;/P&gt;
&lt;P&gt;Try using a LIBNAME statement to connect to your Hadoop session first (implicit pass-through method). &amp;nbsp; When doing so, use &lt;STRONG&gt;&lt;A href="https://go.documentation.sas.com/?docsetId=acreldb&amp;amp;docsetTarget=n1aqglg4ftdj04n1eyvh2l3367ql.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en"&gt;DBMAX_TEXT= LIBNAME Option&lt;/A&gt;&lt;/STRONG&gt;&amp;nbsp; (set to whatever "x" length you want - Also, you can use &lt;STRONG&gt;&lt;A href="https://go.documentation.sas.com/?docsetId=acreldb&amp;amp;docsetTarget=n0v4ma1zb9lu99n1728j279rjcqi.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en"&gt;DBSASTYPE= Data Set Option&lt;/A&gt;&lt;/STRONG&gt; to fix columns one at a time).&lt;/P&gt;
&lt;P&gt;This will substring all STRING columns to "x" bytes&amp;nbsp; upon "READ" by SAS.&amp;nbsp; Here's an example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;LIBNAME hdp HADOOP &lt;BR /&gt;&amp;nbsp;port=10000 &lt;BR /&gt;&amp;nbsp;schema=default &lt;BR /&gt;&amp;nbsp;host="sasserver.demo.sas.com" &amp;nbsp; /* replace with your server info and other connection values you are using in your CONNECT TO configuration (explicit pass-through method). */&lt;BR /&gt;&amp;nbsp;sql_functions=all &lt;BR /&gt;&amp;nbsp;dbmax_text=100 /* execute the LIBNAME statement with DBMAX_TEXT= option */&lt;BR /&gt;&amp;nbsp;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;proc contents data=hdp.deno3; run; /*similar to SHOW TABLES in Hive so you can see which STRING items got truncated.*/&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;&lt;BR /&gt;Proc Freq Data=hdp.deno3; /* This will deliver your counts - Watch out for high cardinality - Other procs for count might be better suited depending on the column values (I.e. PROC MEANS for numeric data */&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; Table &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: black; direction: ltr; font-family: Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace; font-size: 1em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.5; -ms-hyphens: none; orphans: 2; overflow-wrap: normal; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px white; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: normal; word-spacing: normal;"&gt; name&lt;/SPAN&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: black; direction: ltr; font-family: Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace; font-size: 1em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.5; -ms-hyphens: none; orphans: 2; overflow-wrap: normal; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px white; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: normal; word-spacing: normal;"&gt; STATEFP&lt;/SPAN&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: black; direction: ltr; font-family: Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace; font-size: 1em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.5; -ms-hyphens: none; orphans: 2; overflow-wrap: normal; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px white; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: normal; word-spacing: normal;"&gt; COUNTYFP&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: black; direction: ltr; font-family: Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace; font-size: 1em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.5; -ms-hyphens: none; orphans: 2; overflow-wrap: normal; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px white; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: normal; word-spacing: normal;"&gt; ;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good Luck!&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 16:37:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-Access-columns-could-have-a-length-in-SAS-of-32767-extract-0/m-p/628823#M18856</guid>
      <dc:creator>reprui</dc:creator>
      <dc:date>2020-03-02T16:37:29Z</dc:date>
    </item>
  </channel>
</rss>

