<?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: slow proc sort and code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/581708#M165362</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp;you're on the right path.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would probably find it easier to use this BY statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;by product price notsorted;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note, guard against outputting the same observation twice.&amp;nbsp; For example, what would happen if the PRICE changes on the last observation for a PRODUCT?&lt;/P&gt;</description>
    <pubDate>Fri, 16 Aug 2019 13:06:58 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2019-08-16T13:06:58Z</dc:date>
    <item>
      <title>slow proc sort and code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/581671#M165343</link>
      <description>&lt;P&gt;I have following timeseries data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Product	DATE	price
A	01-Jan-18	10
A	02-Jan-18	10
A	03-Jan-18	10
A	04-Jan-18	10
A	05-Jan-18	10
A	06-Jan-18	10
A	07-Jan-18	3
A	08-Jan-18	11
A	10-Jan-18	11
B	15-Jan-18	15
B	16-Jan-17	15
B	17-Jan-17	15
B	20-Jan-17	15
B	21-Jan-17	19
B	22-Jan-17	19
B	23-Jan-17	19
B	24-Jan-17	18&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Table1;

input product $ date date9.  price;
format date date9.;
datalines;
A 01-Jan-18 10
A 02-Jan-18 10
A 03-Jan-18 10
A 04-Jan-18 10
A 05-Jan-18 10
A 06-Jan-18 10
A 07-Jan-18 3
A 08-Jan-18 11
A 10-Jan-18 11
B 15-Jan-18 15
B 16-Jan-17 15
B 17-Jan-17 15
B 20-Jan-17 15
B 21-Jan-17 19
B 22-Jan-17 19
B 23-Jan-17 19
B 24-Jan-17 18
;

run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I wanted an ouput like this&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;PRE&gt;Product	Start_date	End_date	Price
A	01-Jan-18	06-Jan-18	10
A	07-Jan-18	07-Jan-18	3
A	08-Jan-18	08-Jan-18	11
A	10-Jan-18	10-Jan-18	11
B	15-Jan-18	17-Jan-17	15
B	20-Jan-17	20-Jan-17	15
B	21-Jan-17	23-Jan-17	19
B	24-Jan-17	24-Jan-17	18&lt;/PRE&gt;&lt;P&gt;I am running following code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data temp;
set table1;
by product price notsorted;
retain grp;
k=dif(date);
if first.product then grp=1;
else if k ne 1 or first.price then grp+1;
drop k;
run;

proc sql;
create table want as
select distinct product,min(date) as  Start_date	format=date9.,max(date) as End_date format=date9., price
from temp
group by product, grp
order by product, start_date;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;My table1 had more than 80m data, my code run fine and give the output I am looking for but it is taking enormous amount of time.&lt;/P&gt;&lt;P&gt;more than 7 &amp;amp; 8 hours.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way I can optimise it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 10:05:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/581671#M165343</guid>
      <dc:creator>Srigyan</dc:creator>
      <dc:date>2019-08-16T10:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: slow proc sort and code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/581672#M165344</link>
      <description>&lt;P&gt;What part takes time, the PROC SORT or the code you posted?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 10:13:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/581672#M165344</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-08-16T10:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: slow proc sort and code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/581685#M165348</link>
      <description>&lt;P&gt;Try this approach. Btw, you have an error in your sample data at the first obs in Product=B&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data Table1;
input product $ date date9.  price;
format date date9.;
datalines;
A 01-Jan-18 10
A 02-Jan-18 10
A 03-Jan-18 10
A 04-Jan-18 10
A 05-Jan-18 10
A 06-Jan-18 10
A 07-Jan-18 3
A 08-Jan-18 11
A 10-Jan-18 11
B 15-Jan-17 15
B 16-Jan-17 15
B 17-Jan-17 15
B 20-Jan-17 15
B 21-Jan-17 19
B 22-Jan-17 19
B 23-Jan-17 19
B 24-Jan-17 18
;

data temp;
    set Table1;
    if product ne lag(product) or price ne lag(price) or dif(date) gt 1 then n+1;
run;

proc summary data=temp nway;
    class n Product Price;
    var date;
    output out=want(keep=Product Price Start_date End_date) min=Start_date max=End_date;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Aug 2019 11:34:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/581685#M165348</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-08-16T11:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: slow proc sort and code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/581687#M165349</link>
      <description>&lt;P&gt;I do not see a proc sort here:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/200312"&gt;@Srigyan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have following timeseries data&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Product	DATE	price
A	01-Jan-18	10
A	02-Jan-18	10
A	03-Jan-18	10
A	04-Jan-18	10
A	05-Jan-18	10
A	06-Jan-18	10
A	07-Jan-18	3
A	08-Jan-18	11
A	10-Jan-18	11
B	15-Jan-18	15
B	16-Jan-17	15
B	17-Jan-17	15
B	20-Jan-17	15
B	21-Jan-17	19
B	22-Jan-17	19
B	23-Jan-17	19
B	24-Jan-17	18&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Table1;

input product $ date date9.  price;
format date date9.;
datalines;
A 01-Jan-18 10
A 02-Jan-18 10
A 03-Jan-18 10
A 04-Jan-18 10
A 05-Jan-18 10
A 06-Jan-18 10
A 07-Jan-18 3
A 08-Jan-18 11
A 10-Jan-18 11
B 15-Jan-18 15
B 16-Jan-17 15
B 17-Jan-17 15
B 20-Jan-17 15
B 21-Jan-17 19
B 22-Jan-17 19
B 23-Jan-17 19
B 24-Jan-17 18
;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I wanted an ouput like this&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;PRE&gt;Product	Start_date	End_date	Price
A	01-Jan-18	06-Jan-18	10
A	07-Jan-18	07-Jan-18	3
A	08-Jan-18	08-Jan-18	11
A	10-Jan-18	10-Jan-18	11
B	15-Jan-18	17-Jan-17	15
B	20-Jan-17	20-Jan-17	15
B	21-Jan-17	23-Jan-17	19
B	24-Jan-17	24-Jan-17	18&lt;/PRE&gt;
&lt;P&gt;I am running following code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data temp;
set table1;
by product price notsorted;
retain grp;
k=dif(date);
if first.product then grp=1;
else if k ne 1 or first.price then grp+1;
drop k;
run;

proc sql;
create table want as
select distinct product,min(date) as  Start_date	format=date9.,max(date) as End_date format=date9., price
from temp
group by product, grp
order by product, start_date;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;My table1 had more than 80m data, my code run fine and give the output I am looking for but it is taking enormous amount of time.&lt;/P&gt;
&lt;P&gt;more than 7 &amp;amp; 8 hours.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there any way I can optimise it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 11:39:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/581687#M165349</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-08-16T11:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: slow proc sort and code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/581691#M165353</link>
      <description>Get rid of SQL.  It won't take advantage of the fact that the data is sorted.  Faster: &lt;BR /&gt;&lt;BR /&gt;proc summary data=temp;&lt;BR /&gt;by product grp notsorted;&lt;BR /&gt;var date;&lt;BR /&gt;output out=want (drop=_freq_ _type_ grp)&lt;BR /&gt;min=start_date max=end_date;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;Faster still: it would require a few revisions to the DATA step to make it produce WANT.  There are a few tricky aspects to that, however.</description>
      <pubDate>Fri, 16 Aug 2019 11:43:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/581691#M165353</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-08-16T11:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: slow proc sort and code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/581694#M165356</link>
      <description>&lt;P&gt;It has already been mentioned: if you talk about something being slow, posting full log is required to see where the problem is.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And, as has been said, too: you don't need proc sql to solve the problem a data step is all you need, is all you need ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set table1(rename=(Price = _Price));
   by product;

   length Start_date End_date Price 8;
   format Start_date End_date date9.;
   retain Start_date Price;

   if first.product then do;
      Start_date = DAte;
      price = _price;
   end;

   _last = lag(Date);

   if price ^= _price then do;
      End_Date = _last;
      output;
      Start_Date = Date;
      price = _price;
   end;

   if not missing(_last) and _last+1 &amp;lt; Date then do;
      End_date = _last;
      output;
      Start_date = date;
   end;

   if last.product then do;
      End_date = date;
      output;
   end;

   drop _:;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;happy weekend &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://communities.sas.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 11:51:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/581694#M165356</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-08-16T11:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: slow proc sort and code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/581708#M165362</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp;you're on the right path.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would probably find it easier to use this BY statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;by product price notsorted;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note, guard against outputting the same observation twice.&amp;nbsp; For example, what would happen if the PRICE changes on the last observation for a PRODUCT?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 13:06:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/581708#M165362</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-08-16T13:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: slow proc sort and code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/581712#M165364</link>
      <description>&lt;P&gt;Too late to the party. Hmm, Just 9:22 EDT the day seems gone. Anyways, here is my attempt&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Table1;
input product $ date date9.  price;
format date date9.;
datalines;
A 01-Jan-18 10
A 02-Jan-18 10
A 03-Jan-18 10
A 04-Jan-18 10
A 05-Jan-18 10
A 06-Jan-18 10
A 07-Jan-18 3
A 08-Jan-18 11
A 10-Jan-18 11
B 15-Jan-17 15
B 16-Jan-17 15
B 17-Jan-17 15
B 20-Jan-17 15
B 21-Jan-17 19
B 22-Jan-17 19
B 23-Jan-17 19
B 24-Jan-17 18
;


data want ;
 length product $8 Start_date End_date price 8;/*Just to maintain order of variables*/
 if _n_=1 then do;
    dcl hash H (dataset:'Table1',multidata:'y') ;
    h.definekey  ("product","price","date") ;
    h.definedone () ;
 end;
 set Table1;
 by product price notsorted date ;
 if first.date;
 do date=date by 1 while(h.check()=0);
  Start_date=min(Start_date	,date);
  End_date=max(End_date,date);
  rc=h.remove();
 end;
 if Start_date&amp;gt;. and End_date&amp;gt;. then output;
 keep product Start_date End_date price;
 format start_date end_date date9.;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Aug 2019 13:35:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/581712#M165364</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-08-16T13:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: slow proc sort and code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/581713#M165365</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp;you're on the right path.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would probably find it easier to use this BY statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;by product price notsorted;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note, guard against outputting the same observation twice.&amp;nbsp; For example, what would happen if the PRICE changes on the last observation for a PRODUCT?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;thanks for your input, i thought about using the by-statement you mention, but what requires "notsorted" that one price appears only once in the data? Could check this myself, of course, but i am already late for leaving office &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 13:25:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/581713#M165365</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-08-16T13:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: slow proc sort and code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/581737#M165370</link>
      <description>&lt;P&gt;Temp array is convenient too&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Table1;
input product $ date date9.  price;
format date date9.;
datalines;
A 01-Jan-18 10
A 02-Jan-18 10
A 03-Jan-18 10
A 04-Jan-18 10
A 05-Jan-18 10
A 06-Jan-18 10
A 07-Jan-18 3
A 08-Jan-18 11
A 10-Jan-18 11
B 15-Jan-17 15
B 16-Jan-17 15
B 17-Jan-17 15
B 20-Jan-17 15
B 21-Jan-17 19
B 22-Jan-17 19
B 23-Jan-17 19
B 24-Jan-17 18
;

data want;
 length product $8 Start_date End_date price 8;/*Just to maintain order of variables*/
 do _n_=1 by 1 until(last.price);
  set table1;
  by product price notsorted date ;
  array t(99999) _temporary_;
  t(_n_)=date; 
 end;
 do _n_=1 to _n_;
  set table1;
  if date not in t then continue;
  do date= date by 1 while(date in t);
   Start_date=min(Start_date	,date);
   End_date=max(End_date,date);
   call missing(t(whichn(date,of t(*))));
  end;
  output;
  call missing(Start_date,end_date);
 end;
 call missing(of t(*));
 drop date;
 format start_date end_date date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Aug 2019 14:56:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/581737#M165370</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-08-16T14:56:29Z</dc:date>
    </item>
    <item>
      <title>Re: slow proc sort and code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/581743#M165374</link>
      <description>&lt;P&gt;So you want to collapse periods of time where the PRICE doesn't change?&lt;/P&gt;
&lt;P&gt;Make sure the data is sorted by product and date.&amp;nbsp; The use BY product price NOTSORTED and SAS will automatically detect the groups.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could find the start and stop date yourself.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  do until (last.price);
    set table1;
    by product price notsorted;
    if first.price then start_date=date;
  end;
  end_date=date;
  drop date;
  format start_date end_date date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or let PROC SUMMARY do it for you.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=table1 nway;
  by producet price notsorted;
  var date ;
  output out=want(drop=_type_ _freq_) min=start_date max=end_date;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Try both and see which is faster.&amp;nbsp; I would expect PROC SUMMARY might take less wall clock time since it should be able to run the groups in parallel, but perhaps the NOTSORTED option will prevent that.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 15:14:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/581743#M165374</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-08-16T15:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: slow proc sort and code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/584279#M166371</link>
      <description>&lt;P&gt;Thanks for putting your effort. I could have chose only one code as solution.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2019 15:53:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/584279#M166371</guid>
      <dc:creator>Srigyan</dc:creator>
      <dc:date>2019-08-27T15:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: slow proc sort and code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/584283#M166375</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/200312"&gt;@Srigyan&lt;/a&gt;&amp;nbsp; You're very welcome. It's a buffet to choose from. I am here to learn as much as you do. I am hoping to get as good as some whom I dearly follow and I hope that day isn't too far away. Have a good one. Cheers!&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2019 15:59:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/slow-proc-sort-and-code/m-p/584283#M166375</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-08-27T15:59:02Z</dc:date>
    </item>
  </channel>
</rss>

