<?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: How do I reduce the lengths of columns in proc sql passthrough to pull less data across the netw in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-reduce-the-lengths-of-columns-in-proc-sql-passthrough/m-p/684626#M207503</link>
    <description>&lt;P&gt;Short version - substr does work.&lt;/P&gt;
&lt;P&gt;longer version - the issue in the columns coming out larger than expected is from an encoding change.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think I found my answer here...&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Data-Management/Oracle-column-length-increase-when-metadata-is-registered-to-DI/td-p/31897" target="_blank"&gt;https://communities.sas.com/t5/SAS-Data-Management/Oracle-column-length-increase-when-metadata-is-registered-to-DI/td-p/31897&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;It looks like I've missed a trick in my testing and hadn't picked up the multiple of 4 thing that this person hit.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We recently moved server to an environment that also has a viya installation so our encoding changed to utf-8 and i'm guessing that sas is now picking up that the oracle tables have 4 bytes per character where it used to ignore it on our old server.&lt;/P&gt;
&lt;P&gt;further checks showed that if i substr the column down to 1 character I do get 4 bytes back so I think it might be doing the right thing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your help&lt;/P&gt;</description>
    <pubDate>Thu, 17 Sep 2020 14:27:00 GMT</pubDate>
    <dc:creator>TimCampbell</dc:creator>
    <dc:date>2020-09-17T14:27:00Z</dc:date>
    <item>
      <title>How do I reduce the lengths of columns in proc sql passthrough to pull less data across the network</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-reduce-the-lengths-of-columns-in-proc-sql-passthrough/m-p/684287#M207344</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have a table in an oracle database where one of the text columns is defined to have a length of 400 but the data only has a max length of 20 characters.&lt;/P&gt;
&lt;P&gt;The following query works for me pulling the data out of oracle and storing it in a work table with the right column length.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    connect to oracle (authdomain=XXXXX path=XXXX);
    create table work.table as
        select  
			column_with_length400 length=20
        from
            connection to oracle
            (
                select      
                    column_with_length400
                from
                    oracleschema.tablename 
            )   
        ;
    disconnect from oracle;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The problem I have is that as well as limiting the size of the final dataset, I want to limit the amount of data needing to be pulled across the network and the speed improvement on the query when specifying 'length=20' doesn't seem to be very much compared to when I don't.&lt;/P&gt;
&lt;P&gt;My suspicion is that SAS is pulling the full size of the column across the network and then limiting it to 20 characters in the output.&lt;BR /&gt;Does anyone know how I can get SAS to limit the data to 20 characters at the database end so less data is pulled across the network?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obviously the example query above isn't the full query I am running and there are other details to the query that mean I am tied to using the 'connect to oracle' method here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tim&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2020 15:35:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-reduce-the-lengths-of-columns-in-proc-sql-passthrough/m-p/684287#M207344</guid>
      <dc:creator>TimCampbell</dc:creator>
      <dc:date>2020-09-16T15:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do I reduce the lengths of columns in proc sql passthrough to pull less data across the netw</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-reduce-the-lengths-of-columns-in-proc-sql-passthrough/m-p/684290#M207346</link>
      <description>&lt;P&gt;I don't think there is a way to tell SAS to do it.&amp;nbsp; However, you could modify the passthrough query to trim the value.&amp;nbsp; The exact syntax would depend on the oracle, but something like this.&lt;/P&gt;
&lt;PRE&gt;proc sql;
    connect to oracle (authdomain=XXXXX path=XXXX);
    create table work.table as
        select  
			column_with_length400 length=20
        from
            connection to oracle
            (
                select      
                    substr(column_with_length400,1,20) as column_with_length400
                from
                    oracleschema.tablename 
            )   
        ;
    disconnect from oracle;
quit;&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Sep 2020 15:41:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-reduce-the-lengths-of-columns-in-proc-sql-passthrough/m-p/684290#M207346</guid>
      <dc:creator>CurtisMackWSIPP</dc:creator>
      <dc:date>2020-09-16T15:41:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do I reduce the lengths of columns in proc sql passthrough to pull less data across the netw</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-reduce-the-lengths-of-columns-in-proc-sql-passthrough/m-p/684529#M207448</link>
      <description>&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;the substr syntax is correct but the column still comes back as length 400.&lt;/P&gt;
&lt;P&gt;also tried the trim function and got the same results.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 09:45:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-reduce-the-lengths-of-columns-in-proc-sql-passthrough/m-p/684529#M207448</guid>
      <dc:creator>TimCampbell</dc:creator>
      <dc:date>2020-09-17T09:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do I reduce the lengths of columns in proc sql passthrough to pull less data across the netw</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-reduce-the-lengths-of-columns-in-proc-sql-passthrough/m-p/684613#M207494</link>
      <description>Good to know.  Sorry I don't have any other ideas.</description>
      <pubDate>Thu, 17 Sep 2020 14:08:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-reduce-the-lengths-of-columns-in-proc-sql-passthrough/m-p/684613#M207494</guid>
      <dc:creator>CurtisMackWSIPP</dc:creator>
      <dc:date>2020-09-17T14:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: How do I reduce the lengths of columns in proc sql passthrough to pull less data across the netw</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-reduce-the-lengths-of-columns-in-proc-sql-passthrough/m-p/684626#M207503</link>
      <description>&lt;P&gt;Short version - substr does work.&lt;/P&gt;
&lt;P&gt;longer version - the issue in the columns coming out larger than expected is from an encoding change.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think I found my answer here...&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Data-Management/Oracle-column-length-increase-when-metadata-is-registered-to-DI/td-p/31897" target="_blank"&gt;https://communities.sas.com/t5/SAS-Data-Management/Oracle-column-length-increase-when-metadata-is-registered-to-DI/td-p/31897&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;It looks like I've missed a trick in my testing and hadn't picked up the multiple of 4 thing that this person hit.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We recently moved server to an environment that also has a viya installation so our encoding changed to utf-8 and i'm guessing that sas is now picking up that the oracle tables have 4 bytes per character where it used to ignore it on our old server.&lt;/P&gt;
&lt;P&gt;further checks showed that if i substr the column down to 1 character I do get 4 bytes back so I think it might be doing the right thing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your help&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 14:27:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-reduce-the-lengths-of-columns-in-proc-sql-passthrough/m-p/684626#M207503</guid>
      <dc:creator>TimCampbell</dc:creator>
      <dc:date>2020-09-17T14:27:00Z</dc:date>
    </item>
  </channel>
</rss>

