<?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 Creating temporary DB table using implicit pass through takes too long in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-temporary-DB-table-using-implicit-pass-through-takes/m-p/826203#M326339</link>
    <description>&lt;P&gt;&lt;FONT size="3"&gt;We use SAS 9.4 on a Linux platform. All Studies share the same MS SQL DB Tables and I only want to overwrite the data for the Study currently being processed. So, I wrote a macro that:&lt;/FONT&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT size="3"&gt;Creates a temporary DB table from the current Study’s SAS dataset.&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="3"&gt;Deletes the current Study’s data from the permanent DB table.&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="3"&gt;Loads the temporary DB table into the permanent DB table.&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="3"&gt;Drops the temporary DB table.&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;FONT size="3"&gt;Everything works beautifully. However, since we cannot create a MS SQL Server table from a SAS dataset using explicit pass through SQL, I have to create the temporary DB table using implicit pass through.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;PROBLEM: Creating the temporary DB table using implicit pass through takes over 2 hours to load 5 million records. Is there a better way of doing this? Below is my macro.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kc_dn_0-1659119634014.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73895i2D58843226C13F9D/image-size/large?v=v2&amp;amp;px=999" role="button" title="kc_dn_0-1659119634014.png" alt="kc_dn_0-1659119634014.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Any help much appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 29 Jul 2022 18:40:15 GMT</pubDate>
    <dc:creator>kc_dn</dc:creator>
    <dc:date>2022-07-29T18:40:15Z</dc:date>
    <item>
      <title>Creating temporary DB table using implicit pass through takes too long</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-temporary-DB-table-using-implicit-pass-through-takes/m-p/826203#M326339</link>
      <description>&lt;P&gt;&lt;FONT size="3"&gt;We use SAS 9.4 on a Linux platform. All Studies share the same MS SQL DB Tables and I only want to overwrite the data for the Study currently being processed. So, I wrote a macro that:&lt;/FONT&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT size="3"&gt;Creates a temporary DB table from the current Study’s SAS dataset.&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="3"&gt;Deletes the current Study’s data from the permanent DB table.&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="3"&gt;Loads the temporary DB table into the permanent DB table.&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="3"&gt;Drops the temporary DB table.&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;FONT size="3"&gt;Everything works beautifully. However, since we cannot create a MS SQL Server table from a SAS dataset using explicit pass through SQL, I have to create the temporary DB table using implicit pass through.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;PROBLEM: Creating the temporary DB table using implicit pass through takes over 2 hours to load 5 million records. Is there a better way of doing this? Below is my macro.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kc_dn_0-1659119634014.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73895i2D58843226C13F9D/image-size/large?v=v2&amp;amp;px=999" role="button" title="kc_dn_0-1659119634014.png" alt="kc_dn_0-1659119634014.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Any help much appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2022 18:40:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-temporary-DB-table-using-implicit-pass-through-takes/m-p/826203#M326339</guid>
      <dc:creator>kc_dn</dc:creator>
      <dc:date>2022-07-29T18:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: Creating temporary DB table using implicit pass through takes too long</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-temporary-DB-table-using-implicit-pass-through-takes/m-p/826212#M326343</link>
      <description>&lt;P&gt;Rather than PROC SQL SELECT try a PROC DATASETS COPY.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets lib=atr;
*copy over final to atr library;
copy in=work out=atr;
select final;
*rename final data set to temp;
change final=TEMP;
run; quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;The SQL step is reading each line one at a time, where COPY will copy in bulk.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have the correct SAS license (SAS/ACCESS) you can also try SAS DBLOAD.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acreldb/n0o4e1x3ggqlxan12sokc2lbgxbh.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acreldb/n0o4e1x3ggqlxan12sokc2lbgxbh.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2022 19:23:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-temporary-DB-table-using-implicit-pass-through-takes/m-p/826212#M326343</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-07-29T19:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: Creating temporary DB table using implicit pass through takes too long</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-temporary-DB-table-using-implicit-pass-through-takes/m-p/826256#M326373</link>
      <description>&lt;P&gt;In addition to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;'s suggestion adding the options UPDATEBUFF and DBCOMMIT to your STR LIBNAME statement can make a HUGE difference in data loading performance. The default values for these options are not very efficient in my experience. You will probably need to experiment with different values to get the best load times. I suggest you try values like 1,000, 5,000, 10,000 and so on, but test it on a subset of your 5 million rows to speed up the testing process.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jul 2022 05:08:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-temporary-DB-table-using-implicit-pass-through-takes/m-p/826256#M326373</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-07-30T05:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: Creating temporary DB table using implicit pass through takes too long</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-temporary-DB-table-using-implicit-pass-through-takes/m-p/826756#M326557</link>
      <description>&lt;P&gt;Thanks! I tried all three values on a million records and it appears DBCOMMIT=10000 INSERTBUFF=10000 provides the most improvement.&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: PROCEDURE DATASETS used (Total process time):&lt;BR /&gt;real time 8:56.77&lt;BR /&gt;cpu time 18.00 seconds&lt;/P&gt;&lt;P&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 9:15.28&lt;BR /&gt;cpu time 17.61 seconds&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 00:32:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-temporary-DB-table-using-implicit-pass-through-takes/m-p/826756#M326557</guid>
      <dc:creator>kc_dn</dc:creator>
      <dc:date>2022-08-03T00:32:15Z</dc:date>
    </item>
    <item>
      <title>Re: Creating temporary DB table using implicit pass through takes too long</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-temporary-DB-table-using-implicit-pass-through-takes/m-p/826757#M326558</link>
      <description>&lt;P&gt;Thanks! I tested it on a million records and it provides a slight improvement over PROC SQL if paired with DBCOMMIT=10000 INSERTBUFF=10000 as suggested in the other reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: PROCEDURE DATASETS used (Total process time):&lt;BR /&gt;real time 8:56.77&lt;BR /&gt;cpu time 18.00 seconds&lt;/P&gt;&lt;P&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 9:15.28&lt;BR /&gt;cpu time 17.61 seconds&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 00:34:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-temporary-DB-table-using-implicit-pass-through-takes/m-p/826757#M326558</guid>
      <dc:creator>kc_dn</dc:creator>
      <dc:date>2022-08-03T00:34:43Z</dc:date>
    </item>
    <item>
      <title>Re: Creating temporary DB table using implicit pass through takes too long</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-temporary-DB-table-using-implicit-pass-through-takes/m-p/826762#M326561</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/430553"&gt;@kc_dn&lt;/a&gt;&amp;nbsp; - Woohoo! That's a massive improvement! Can't complain about loading a million rows in 9 minutes. Bulk loading might improve things further but if you are happy with the current load times I wouldn't bother.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 01:10:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-temporary-DB-table-using-implicit-pass-through-takes/m-p/826762#M326561</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-08-03T01:10:00Z</dc:date>
    </item>
  </channel>
</rss>

