<?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: Passing huge String without Macro variable in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Passing-huge-String-without-Macro-variable-in-SAS/m-p/962281#M375073</link>
    <description>&lt;P&gt;Not billions but smallest is 5K rows of criteria - combination of g and p .&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, a temp dataset or table can be created but I will have to do this every time I want to run the code. This is due to the fact that the g and p combination values are dynamic and keep changing ; its not possible to stored in a permanent table.&lt;/P&gt;</description>
    <pubDate>Wed, 19 Mar 2025 20:28:03 GMT</pubDate>
    <dc:creator>R_K_</dc:creator>
    <dc:date>2025-03-19T20:28:03Z</dc:date>
    <item>
      <title>Passing huge String without Macro variable in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Passing-huge-String-without-Macro-variable-in-SAS/m-p/962229#M375051</link>
      <description>&lt;P&gt;Seems there is a limit to the string size that can be passed in a SAS variable and/or SAS macro variable.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ERROR: CLI describe error: [IBM][CLI Driver][DB2/AIX64] SQL0101N&amp;nbsp; The statement&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; was not processed because a limit such as a memory limit, an SQL limit,&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; or a database limit was reached.&amp;nbsp; SQLSTATE=54001&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;To resolve this is the only solution to create a sastemp? Are there alternative ways?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The string criteria limiting the data is a combination of two variables and is huge .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Sample :&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;g&lt;/TD&gt;&lt;TD&gt;p&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;297&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;297&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;462&lt;/TD&gt;&lt;TD&gt;CA&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;462&lt;/TD&gt;&lt;TD&gt;CB&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;462&lt;/TD&gt;&lt;TD&gt;CS&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;462&lt;/TD&gt;&lt;TD&gt;CT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;462&lt;/TD&gt;&lt;TD&gt;EA&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;462&lt;/TD&gt;&lt;TD&gt;EB&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;462&lt;/TD&gt;&lt;TD&gt;ES&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;462&lt;/TD&gt;&lt;TD&gt;ET&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;635&lt;/TD&gt;&lt;TD&gt;JC&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;635&lt;/TD&gt;&lt;TD&gt;JD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;635&lt;/TD&gt;&lt;TD&gt;JK&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;635&lt;/TD&gt;&lt;TD&gt;JL&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1987&lt;/TD&gt;&lt;TD&gt;AA&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1987&lt;/TD&gt;&lt;TD&gt;AB&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1987&lt;/TD&gt;&lt;TD&gt;BA&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1987&lt;/TD&gt;&lt;TD&gt;BB&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Sample query:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;proc sql;&lt;BR /&gt;connect to db2(database=xxxxx000 &amp;amp;_log_host );/*connect to the database*/&lt;BR /&gt;create table temp as&amp;nbsp;&amp;nbsp;&lt;BR /&gt;select * from connection to db2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;( select&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;a.x, a.y&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; from&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; abc.clm as a&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;where&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; a.open_dt between '2024-01-01' and '2024-12-31'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; and&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;( a.g in ('297') and a.p in ('A','B')) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;or ( a.g in ('462') and a.p in ('CA','CB','CS','CT','EA','EB','ES','ET')) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;or ( a.g in ('635') and a.p in ('JC','JD','JK','JL')) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;or ( a.g in ('1987') and a.p in ('AA','AB','BA','BB')) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;or ....&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;with ur);&amp;nbsp;&amp;nbsp;&lt;BR /&gt;%put &amp;amp;sqlxmsg;&lt;BR /&gt;disconnect from db2;&lt;BR /&gt;%put &amp;amp;sqlxmsg;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2025 13:09:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Passing-huge-String-without-Macro-variable-in-SAS/m-p/962229#M375051</guid>
      <dc:creator>R_K_</dc:creator>
      <dc:date>2025-03-19T13:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: Passing huge String without Macro variable in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Passing-huge-String-without-Macro-variable-in-SAS/m-p/962245#M375054</link>
      <description>&lt;P&gt;Hard to tell what the question is.&amp;nbsp; And also whether the error message has anything to do with your actual issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think perhaps you are asking how to filter data by a combination of two variables, in this example they are named G and P.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, yes, the best solution is to create a table in the remote database with the list of values and then ask the remote database to do something like an inner join that will filter the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have permission to make temporary tables in the remote database? Or is there a permanent table that you can load values into?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2025 15:18:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Passing-huge-String-without-Macro-variable-in-SAS/m-p/962245#M375054</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-03-19T15:18:06Z</dc:date>
    </item>
    <item>
      <title>Re: Passing huge String without Macro variable in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Passing-huge-String-without-Macro-variable-in-SAS/m-p/962256#M375058</link>
      <description>&lt;P&gt;Yeah, creating a #temp table on the SQL side is almost certainly a better way to go about this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sqllib.'#GPdata'n;
set GPdata (keep=G P);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;...and then in the SQL passthru, just inner join your CLM data to #GPdata on G and P.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2025 16:10:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Passing-huge-String-without-Macro-variable-in-SAS/m-p/962256#M375058</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2025-03-19T16:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: Passing huge String without Macro variable in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Passing-huge-String-without-Macro-variable-in-SAS/m-p/962261#M375062</link>
      <description>&lt;P&gt;SAS variable , macro variable does not work and throws error.&lt;/P&gt;&lt;P&gt;I know I could create a temp table and use inner join.&lt;/P&gt;&lt;P&gt;The issue was that criteria on which the data needs to be limited is huge and I was looking for an alternative solution anything other than creating a table?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2025 17:23:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Passing-huge-String-without-Macro-variable-in-SAS/m-p/962261#M375062</guid>
      <dc:creator>R_K_</dc:creator>
      <dc:date>2025-03-19T17:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: Passing huge String without Macro variable in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Passing-huge-String-without-Macro-variable-in-SAS/m-p/962264#M375065</link>
      <description>What do you mean by "huge"?  Billions of records?  Do you literally not have enough memory available to create a temp table?  You could also create a permanent table (i.e., without the #) in whatever schema for which you have write access and then drop it after you're done if the issue is insufficient memory.</description>
      <pubDate>Wed, 19 Mar 2025 17:53:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Passing-huge-String-without-Macro-variable-in-SAS/m-p/962264#M375065</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2025-03-19T17:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: Passing huge String without Macro variable in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Passing-huge-String-without-Macro-variable-in-SAS/m-p/962281#M375073</link>
      <description>&lt;P&gt;Not billions but smallest is 5K rows of criteria - combination of g and p .&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, a temp dataset or table can be created but I will have to do this every time I want to run the code. This is due to the fact that the g and p combination values are dynamic and keep changing ; its not possible to stored in a permanent table.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2025 20:28:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Passing-huge-String-without-Macro-variable-in-SAS/m-p/962281#M375073</guid>
      <dc:creator>R_K_</dc:creator>
      <dc:date>2025-03-19T20:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: Passing huge String without Macro variable in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Passing-huge-String-without-Macro-variable-in-SAS/m-p/962282#M375074</link>
      <description>&lt;P&gt;A temporary table is your best option as it avoids limits on lengths of SAS and macro variables and SQL statements.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2025 20:36:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Passing-huge-String-without-Macro-variable-in-SAS/m-p/962282#M375074</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2025-03-19T20:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: Passing huge String without Macro variable in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Passing-huge-String-without-Macro-variable-in-SAS/m-p/962320#M375079</link>
      <description>&lt;P&gt;You can exchange variables with strings up-to 32767 characters between SAS and a DB. You need to set connection option dbmaxtext=32767 because the default is normally 4096 characters.&lt;/P&gt;
&lt;P&gt;I can't see in your code where you would use such a variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also not sure how you would use a macro variable. Is your idea to construct some where condition on the SAS side and store it in a macro variable that you then use in your SQL query? I guess that would work as long as the string fits into the SAS macro variable (max 32767 or 65534 characters depending on environment).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From how it looks like loading your (still small) SAS table first into a DB table (could be a temporary table) for a join is likely the appropriate approach.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2025 09:26:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Passing-huge-String-without-Macro-variable-in-SAS/m-p/962320#M375079</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2025-03-20T09:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: Passing huge String without Macro variable in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Passing-huge-String-without-Macro-variable-in-SAS/m-p/962489#M375128</link>
      <description>&lt;P&gt;I don't see where you use a macro variable.&lt;/P&gt;
&lt;P&gt;In any case, the message&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;ERROR: CLI describe error: [IBM][CLI Driver][DB2/AIX64] SQL0101N The statement &lt;BR /&gt;was not processed because a limit such as a memory limit, an SQL limit, &lt;BR /&gt;or a database limit was reached. SQLSTATE=54001&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;indicates that the statement is too long or too complex.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is a DB2 limitation: Your SQL clause is too long or complex and DB2 rejects it.&lt;BR /&gt;See &lt;A href="https://www.ibm.com/docs/en/db2-for-zos/12?topic=codes-101" target="_blank"&gt;https://www.ibm.com/docs/en/db2-for-zos/12?topic=codes-101&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Talk to the DB2 DBA for recommendations.&lt;/P&gt;
&lt;P&gt;As stated, the simplest work-around is to join to an uploaded table.&lt;/P&gt;
&lt;P&gt;Another solution is to send a query smaller than the maximum allowed, and apply the rest of the tests in a subsequent phase.&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Mar 2025 05:42:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Passing-huge-String-without-Macro-variable-in-SAS/m-p/962489#M375128</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2025-03-24T05:42:45Z</dc:date>
    </item>
  </channel>
</rss>

