<?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: Needing help finding a faster way to loop through a dataset with 28 million rows in &amp;lt; 12 hour in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Needing-help-finding-a-faster-way-to-loop-through-a-dataset-with/m-p/781288#M39858</link>
    <description>&lt;P&gt;From your code, it looks as if your dataset is in WORK (single level name). Is your VPN purely on your connection to a SAS server, or do you actually run SAS on your PC and connect to the data through the VPN?&lt;/P&gt;</description>
    <pubDate>Fri, 19 Nov 2021 15:53:37 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-11-19T15:53:37Z</dc:date>
    <item>
      <title>Needing help finding a faster way to loop through a dataset with 28 million rows in &lt; 12 hours</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Needing-help-finding-a-faster-way-to-loop-through-a-dataset-with/m-p/779838#M39835</link>
      <description>Version 7.1 Looking for some help, my only co-worker left a few weeks ago and I have to have this data pulled for billing our vendors. Admittedly, I probably don’t know as much as I should for this analyst role but it was forced on me after we lost someone and I had been learning from my only team member previously.&lt;BR /&gt;&lt;BR /&gt;Using SQL in SAS. I’m trying to pull the last 4 years of usage history from a dataset containing 28 million rows. The problem is I can’t get it to run in less than 12 hours before I get kicked off the VPN. Last month the table had 27 million and it ran just fine but this month no luck. There is a lot more to this code but this is the part that takes the longest.&lt;BR /&gt;&lt;BR /&gt;%datacon;&lt;BR /&gt;%let billmo = 10;&lt;BR /&gt;%let billyr = 2021;&lt;BR /&gt;&lt;BR /&gt;Proc sql;&lt;BR /&gt;Create table prior4yr&lt;BR /&gt;Select *&lt;BR /&gt;From usage_history&lt;BR /&gt;Where year(datepart(first_login)) &amp;gt; sum((&amp;amp;billyr.,-4) or (year(datepart(first_login)) = sum(&amp;amp;billyr., -4) and month(datepart(first_login)) &amp;gt; &amp;amp;billmo.);&lt;BR /&gt;Quit;&lt;BR /&gt;&lt;BR /&gt;Is there a way to rewrite this so it doesn’t have to look through all the 28 million rows in usage_history? If it’s helpful at all, I pull this data every month so I do have an older copy of my prior4yr table saved and I really only need to pull in data from the last 2 months to add to prior4yr.</description>
      <pubDate>Thu, 11 Nov 2021 17:46:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Needing-help-finding-a-faster-way-to-loop-through-a-dataset-with/m-p/779838#M39835</guid>
      <dc:creator>Marrrissa</dc:creator>
      <dc:date>2021-11-11T17:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: Needing help finding a faster way to loop through a dataset with 28 million rows in &lt; 12 hour</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Needing-help-finding-a-faster-way-to-loop-through-a-dataset-with/m-p/779848#M39836</link>
      <description>&lt;P&gt;It looks like you are reading this data from an external database. Do you know what it is? You can most likely speed this up by converting it to an SQL Passthru query that uses database-specific SQL. Also your WHERE statement should be just a DATETIME selection and not include functions. Something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Bill_Date = %sysfunc(intnx(MONTH, %sysfunc(today()), -1, BEGINNING), date9.);
%put Bill_Date = &amp;amp;Bill_Date;

proc sql;
  create table want as
  select *
  from have
  where first_login &amp;gt; "&amp;amp;Bill_Date.:00:00:00"dt;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Nov 2021 19:30:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Needing-help-finding-a-faster-way-to-loop-through-a-dataset-with/m-p/779848#M39836</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-11-11T19:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: Needing help finding a faster way to loop through a dataset with 28 million rows in &lt; 12 hour</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Needing-help-finding-a-faster-way-to-loop-through-a-dataset-with/m-p/779884#M39838</link>
      <description>IME a basic query like this should run in under 20 minutes on a server or 1 hour on a desktop. &lt;BR /&gt;Something else is the issue...did the VPN change? Did your coworker have some extra privileges or access to more resources on the server as a super user or something?</description>
      <pubDate>Fri, 12 Nov 2021 01:06:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Needing-help-finding-a-faster-way-to-loop-through-a-dataset-with/m-p/779884#M39838</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-11-12T01:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: Needing help finding a faster way to loop through a dataset with 28 million rows in &lt; 12 hour</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Needing-help-finding-a-faster-way-to-loop-through-a-dataset-with/m-p/779921#M39848</link>
      <description>&lt;P&gt;A lot of times, these large, exponential increases in time are due to network latency. The dataset is on a NAS drive or SAN, and you are trying to pull the data to your local machine across VPN. Do as suggested and force the processing to the server or some place local to the dataset. Ping the server where the dataset is located and you will probably find your culprit. 28M recs is not that much but the time indicates a lot of back and forth over a network.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 04:54:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Needing-help-finding-a-faster-way-to-loop-through-a-dataset-with/m-p/779921#M39848</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2021-11-12T04:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: Needing help finding a faster way to loop through a dataset with 28 million rows in &lt; 12 hour</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Needing-help-finding-a-faster-way-to-loop-through-a-dataset-with/m-p/779961#M39852</link>
      <description>As SASKiwi said, &lt;BR /&gt;if you read data from external database, also try  option ' readbuff=10000 '  of libname statement.</description>
      <pubDate>Fri, 12 Nov 2021 12:41:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Needing-help-finding-a-faster-way-to-loop-through-a-dataset-with/m-p/779961#M39852</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-11-12T12:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: Needing help finding a faster way to loop through a dataset with 28 million rows in &lt; 12 hour</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Needing-help-finding-a-faster-way-to-loop-through-a-dataset-with/m-p/781280#M39857</link>
      <description>&lt;P&gt;You are connecting to a remote database through vpn.&lt;BR /&gt;Try to minimise data transfer. Therefore the query must be executed as sql pass through as suggested by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Nov 2021 15:25:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Needing-help-finding-a-faster-way-to-loop-through-a-dataset-with/m-p/781280#M39857</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2021-11-19T15:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: Needing help finding a faster way to loop through a dataset with 28 million rows in &lt; 12 hour</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Needing-help-finding-a-faster-way-to-loop-through-a-dataset-with/m-p/781288#M39858</link>
      <description>&lt;P&gt;From your code, it looks as if your dataset is in WORK (single level name). Is your VPN purely on your connection to a SAS server, or do you actually run SAS on your PC and connect to the data through the VPN?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Nov 2021 15:53:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Needing-help-finding-a-faster-way-to-loop-through-a-dataset-with/m-p/781288#M39858</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-11-19T15:53:37Z</dc:date>
    </item>
  </channel>
</rss>

