<?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 How to shorten the run time in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-shorten-the-run-time/m-p/693621#M211533</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;In my program I run the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data days_1;&lt;BR /&gt;do day=1 to 10000;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table test as&lt;BR /&gt;select rent.date,day&lt;BR /&gt;from sashelp.rent, days_1&lt;BR /&gt;order by date,day;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In practice, my table has 2200 different dates and not 10 as in the 'rent' table, the run time is very long, looking for a way that the run time will be shorter without Cartesian multiplication or&amp;nbsp;another solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Thu, 22 Oct 2020 21:40:34 GMT</pubDate>
    <dc:creator>shlomiohana</dc:creator>
    <dc:date>2020-10-22T21:40:34Z</dc:date>
    <item>
      <title>How to shorten the run time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-shorten-the-run-time/m-p/693621#M211533</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;In my program I run the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data days_1;&lt;BR /&gt;do day=1 to 10000;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table test as&lt;BR /&gt;select rent.date,day&lt;BR /&gt;from sashelp.rent, days_1&lt;BR /&gt;order by date,day;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In practice, my table has 2200 different dates and not 10 as in the 'rent' table, the run time is very long, looking for a way that the run time will be shorter without Cartesian multiplication or&amp;nbsp;another solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2020 21:40:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-shorten-the-run-time/m-p/693621#M211533</guid>
      <dc:creator>shlomiohana</dc:creator>
      <dc:date>2020-10-22T21:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to shorten the run time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-shorten-the-run-time/m-p/693622#M211534</link>
      <description>&lt;P&gt;Not sure what your output should be but maybe something like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data days_1;
set sashelp.rent;
do day=1 to 10000;
output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Oct 2020 21:58:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-shorten-the-run-time/m-p/693622#M211534</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-10-22T21:58:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to shorten the run time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-shorten-the-run-time/m-p/693649#M211548</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;&amp;nbsp;without Cartesian multiplication&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Well, you are asking for a Cartesian product...&lt;/P&gt;
&lt;P&gt;To speed up IOs on this very simple program, look at increasing BUFSIZE and BUFNO, and using SGIO.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 03:54:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-shorten-the-run-time/m-p/693649#M211548</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-10-23T03:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to shorten the run time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-shorten-the-run-time/m-p/693651#M211550</link>
      <description>&lt;P&gt;You can do the cartesian crossing via a hash object in a data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data want;
  set sashelp.rent  days_1 (obs=0);
  if _n_=1 then do;
    declare hash h (dataset:'days_1',ordered:'a');
	  h.definekey('date');
	  h.definedata(all:'Y');
	  h.definedone();
	declare hiter hi ('h');
  end;
  do while (hi.next()=0);
    output;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This loads DAYS_1 into the hash object (think lookup table) named h, and stores it in ascending order by DAY (even if the original dataset was not sorted).&amp;nbsp; This takes place during the first iteration of the data step ("if _n_=1").&amp;nbsp; The hash object is "retained" for all susequent iterations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then for each obs in sashelp.rent, the program uses the hash iterator hi to step through (i.e. retrieve) every dataitem (think "row") in h, and outputs it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reason I used "obs=0" in the SET statement for the days_1 dataset is to force SAS to make provision for all the variables in days_1 in the program data vector (the hash object declare statement won't suffice).&amp;nbsp; But not to actually read in the data (which IS done in the declare statement).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 04:11:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-shorten-the-run-time/m-p/693651#M211550</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-10-23T04:11:33Z</dc:date>
    </item>
  </channel>
</rss>

