<?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: how to solve the error: sort execution failure in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-solve-the-error-sort-execution-failure/m-p/484202#M125681</link>
    <description>&lt;P&gt;This step&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
set work.lal1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is totally useless. It wastes three lines of code and the whole disk space of the dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, you are most probably running out of disk space when SQL has to sort your dataset for the join or for the unique.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Omit the above step and use lal1 as the source in your SQL.&lt;/P&gt;</description>
    <pubDate>Sun, 05 Aug 2018 19:56:05 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-08-05T19:56:05Z</dc:date>
    <item>
      <title>how to solve the error: sort execution failure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-solve-the-error-sort-execution-failure/m-p/484182#M125667</link>
      <description>&lt;P&gt;Hi, dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After several times, I always have the following error message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ERROR: Sort execution failure.&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Here's my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc options group=memory;&lt;BR /&gt;run;&lt;BR /&gt;proc options option=(work utilloc) value;&lt;BR /&gt;run;&lt;BR /&gt;proc options option=threads;&lt;BR /&gt;run;&lt;BR /&gt;options fullstimer msglevel=i;&lt;/P&gt;&lt;P&gt;proc import out=work.lal1&lt;BR /&gt;datafile='C:\thesis1\ideas\agent_quality\sas.dta'&lt;BR /&gt;dbms=DTA replace;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;set work.lal1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table table1 as&lt;BR /&gt;select unique have.*, count(past1.date_sign) as la2_no_la2&lt;BR /&gt;from have&lt;BR /&gt;left join&lt;BR /&gt;have past1&lt;BR /&gt;on have.listing_2=past1.listing_2&lt;BR /&gt;and 0 &amp;lt; have.date_sign-past1.date_sign&lt;BR /&gt;group by 1&lt;BR /&gt;order by 1 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works before, but since yesterday, I have the above error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I google the reasons and try some methods suggested by others, but the error msg still there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help me to solve it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Freda&lt;/P&gt;</description>
      <pubDate>Sun, 05 Aug 2018 17:06:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-solve-the-error-sort-execution-failure/m-p/484182#M125667</guid>
      <dc:creator>freda</dc:creator>
      <dc:date>2018-08-05T17:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to solve the error: sort execution failure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-solve-the-error-sort-execution-failure/m-p/484185#M125670</link>
      <description>Please post the log of the run and list the things you already tried to avoid useless suggestions.</description>
      <pubDate>Sun, 05 Aug 2018 17:38:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-solve-the-error-sort-execution-failure/m-p/484185#M125670</guid>
      <dc:creator>error_prone</dc:creator>
      <dc:date>2018-08-05T17:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: how to solve the error: sort execution failure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-solve-the-error-sort-execution-failure/m-p/484186#M125671</link>
      <description>&lt;P&gt;&lt;BR /&gt;1 proc options group=memory;&lt;BR /&gt;2 run;&lt;/P&gt;&lt;P&gt;SAS (r) Proprietary Software Release 9.4 TS1M4&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Group=MEMORY&lt;BR /&gt;SORTSIZE=1073741824&lt;BR /&gt;Specifies the amount of memory that is available to the SORT procedure.&lt;BR /&gt;SUMSIZE=0 Specifies a limit on the amount of memory that is available for data summarization procedures when&lt;BR /&gt;class variables are active.&lt;BR /&gt;MAXMEMQUERY=0 Specifies the maximum amount of memory that is allocated for procedures.&lt;BR /&gt;MEMBLKSZ=16777216 Specifies the memory block size for Windows memory-based libraries.&lt;BR /&gt;MEMMAXSZ=2147483648&lt;BR /&gt;Specifies the maximum amount of memory to allocate for using memory-based libraries.&lt;BR /&gt;LOADMEMSIZE=0 Specifies a suggested amount of memory that is needed for executable programs loaded by SAS.&lt;BR /&gt;MEMSIZE=2147483648&lt;BR /&gt;Specifies the limit on the amount of virtual memory that can be used during a SAS session.&lt;BR /&gt;REALMEMSIZE=0 Specifies the amount of real memory SAS can expect to allocate.&lt;BR /&gt;NOTE: PROCEDURE OPTIONS used (Total process time):&lt;BR /&gt;real time 0.01 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;3 proc options option=(work utilloc) value;&lt;BR /&gt;4 run;&lt;/P&gt;&lt;P&gt;SAS (r) Proprietary Software Release 9.4 TS1M4&lt;/P&gt;&lt;P&gt;Option Value Information For SAS Option WORK&lt;BR /&gt;Value: C:\Users\Samuel\AppData\Local\Temp\SAS Temporary Files\_TD10256_SAMUEL-PC_&lt;BR /&gt;Scope: SAS Session&lt;BR /&gt;How option value set: Config File&lt;BR /&gt;Config file name:&lt;BR /&gt;C:\Program Files\SASHome\SASFoundation\9.4\nls\u8\sasv9.cfg&lt;/P&gt;&lt;P&gt;Option Value Information For SAS Option UTILLOC&lt;BR /&gt;Value: WORK&lt;BR /&gt;Scope: Default&lt;BR /&gt;How option value set: Shipped Default&lt;/P&gt;&lt;P&gt;NOTE: PROCEDURE OPTIONS used (Total process time):&lt;BR /&gt;real time 0.01 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;5 proc options option=threads;&lt;BR /&gt;6 run;&lt;/P&gt;&lt;P&gt;SAS (r) Proprietary Software Release 9.4 TS1M4&lt;/P&gt;&lt;P&gt;THREADS Uses threaded processing for SAS applications that support it.&lt;BR /&gt;NOTE: PROCEDURE OPTIONS used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;7 options fullstimer msglevel=i;&lt;BR /&gt;8&lt;BR /&gt;9 proc import out=work.lal1&lt;BR /&gt;10 datafile='C:\thesis1\ideas\agent_quality\sas.dta'&lt;BR /&gt;11 dbms=DTA replace;&lt;BR /&gt;12 run;&lt;/P&gt;&lt;P&gt;NOTE: The import data set has 1553099 observations and 15 variables.&lt;BR /&gt;NOTE: WORK.LAL1 data set was successfully created.&lt;BR /&gt;NOTE: PROCEDURE IMPORT used (Total process time):&lt;BR /&gt;real time 2.13 seconds&lt;BR /&gt;user cpu time 0.29 seconds&lt;BR /&gt;system cpu time 0.20 seconds&lt;BR /&gt;memory 982.87k&lt;BR /&gt;OS Memory 9960.00k&lt;BR /&gt;Timestamp 2018-08-05 12:57:29 PM&lt;BR /&gt;Step Count 4 Switch Count 0&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;13&lt;BR /&gt;14 data have;&lt;BR /&gt;15 set work.lal1;&lt;BR /&gt;16 run;&lt;/P&gt;&lt;P&gt;NOTE: There were 1553099 observations read from the data set WORK.LAL1.&lt;BR /&gt;NOTE: The data set WORK.HAVE has 1553099 observations and 15 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.28 seconds&lt;BR /&gt;user cpu time 0.07 seconds&lt;BR /&gt;system cpu time 0.20 seconds&lt;BR /&gt;memory 882.31k&lt;BR /&gt;OS Memory 10476.00k&lt;BR /&gt;Timestamp 2018-08-05 12:57:30 PM&lt;BR /&gt;Step Count 5 Switch Count 0&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;17&lt;BR /&gt;18&lt;BR /&gt;19 proc sql;&lt;BR /&gt;20 create table table1 as&lt;BR /&gt;21 select unique have.*, count(past1.date_sign) as la2_no_la2&lt;BR /&gt;22 from have&lt;BR /&gt;23 left join&lt;BR /&gt;24 have past1&lt;BR /&gt;25 on have.listing_2=past1.listing_2&lt;BR /&gt;26 and 0 &amp;lt; have.date_sign-past1.date_sign&lt;BR /&gt;27 group by 1&lt;BR /&gt;28 order by 1 ;&lt;BR /&gt;NOTE: The query requires remerging summary statistics back with the original data.&lt;BR /&gt;NOTE: SAS threaded sort was used.&lt;BR /&gt;ERROR: Sort execution failure.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Aug 2018 17:42:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-solve-the-error-sort-execution-failure/m-p/484186#M125671</guid>
      <dc:creator>freda</dc:creator>
      <dc:date>2018-08-05T17:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: how to solve the error: sort execution failure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-solve-the-error-sort-execution-failure/m-p/484202#M125681</link>
      <description>&lt;P&gt;This step&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
set work.lal1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is totally useless. It wastes three lines of code and the whole disk space of the dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, you are most probably running out of disk space when SQL has to sort your dataset for the join or for the unique.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Omit the above step and use lal1 as the source in your SQL.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Aug 2018 19:56:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-solve-the-error-sort-execution-failure/m-p/484202#M125681</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-08-05T19:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: how to solve the error: sort execution failure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-solve-the-error-sort-execution-failure/m-p/484251#M125705</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/224413"&gt;@freda&lt;/a&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your SQL has to sort HAVE twice to make the query happen, which is evident from the notes the SQL statement&amp;nbsp; _METHOD option prints in the log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;sqxcrta
    sqxunqs
        sqxsumg
            sqxjm
                &lt;FONT color="#800000"&gt;&lt;STRONG&gt;sqxsort&lt;/STRONG&gt;&lt;/FONT&gt;
                    sqxsrc( WORK.HAVE(alias = PAST1) )
                &lt;FONT color="#800000"&gt;&lt;STRONG&gt;sqxsort&lt;/STRONG&gt;&lt;/FONT&gt;
                    sqxsrc( WORK.HAVE )&lt;/PRE&gt;&lt;P&gt;You can help SQL by sorting HAVE just once beforehand. Instead of the pointless DATA step that merely creates a copy of LAL1, sort LAL1 into HAVE:&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;proc sort data = lal1 out = have ;
  by listing_2 date_sign ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Proc SORT sets SORTEDBY=LISTING_2 DATE_SIGN data set option on in the descriptor of HAVE, from which SQL will know that the input is already sorted. In this case, when you run the query, you will see the execution methods as:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;sqxcrta
    sqxunqs
        sqxsumg
            sqxjm
                sqxsrc( WORK.HAVE(alias = PAST1) )
                sqxsrc( WORK.HAVE )&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;As you see, there's no SQXSORT execution method listed, i.e. SQL takes the existing sorted order into account and refrains from sorting itself, which will obviously make the SQL sort error go away.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It would be even better if your LAL1 is already &lt;EM&gt;intrinsically&lt;/EM&gt; sorted - meaning that its data are physically in order but the SORTEDBY=LISTING_2 DATE_SIGN is not set. In this case, you don't need to sort anything, just tell SQL that the data are already sorted by specifying SORTEDBY=:&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&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;option msglevel=I ;&lt;BR /&gt;proc sql _method ;
  create table table1 as
  select unique have.*, count(past1.date_sign) as la2_no_la2
  from have &lt;FONT color="#800000"&gt;&lt;STRONG&gt;(sortedby=listing_2 date_sign)&lt;/STRONG&gt;&lt;/FONT&gt;
  left join
  have &lt;FONT color="#800000"&gt;&lt;STRONG&gt;(sortedby=listing_2 date_sign)&lt;/STRONG&gt;&lt;/FONT&gt; past1
  on have.listing_2=past1.listing_2
  and have.date_sign &amp;gt; past1.date_sign
  group by 1
  order by 1 
  ;
quit ;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;In this case, the SQL execution will skip the sorting as well:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;sqxcrta
    sqxunqs
        sqxsumg
            sqxjm
                sqxsrc( WORK.HAVE(alias = PAST1) )
                sqxsrc( WORK.HAVE )&lt;/PRE&gt;&lt;P&gt;If the proc SORT step should fail, it would mean you have a problem with the file size and/or available SORTWORK space and need a conversation with the sysadmin.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If that should fail, you can use the dinosaur method of breaking LAL1 into a number of more or less equal chunks, sorting each, and interleaving the results. For example, if the file has 30 million observations and you break it into 3 chunks, it could look like this:&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=lal1 (firstobs=00000001 obs=10000000) out=c1 ; by listing_2 date_sign ; run ;
proc sort data=lal1 (firstobs=10000001 obs=20000000) out=c2 ; by listing_2 date_sign ; run ;
proc sort data=lal1 (firstobs=20000001 obs=30000000) out=c3 ; by listing_2 date_sign ; run ;
                                                                                            
data have (sortedby=listing_2 date_sign) ;                                                  
  set c1 c2 c3 ;                                                                            
  by listing_2 date_sign ;                                                                  
run ;                                                                                       &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then just run the SQL query against HAVE. Of course, if need be, you can break LAL1 into a greater number of finer chunks. But in the end, if you have enough WORK space to store the chunks (which could be subsequently deleted) and HAVE, you'll get there by hook or by crook. This technique essentially trades the need for SORTWORK space about three times the size of LAL1 for extra WORK space about the same size as LAL1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Paul D.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Aug 2018 04:02:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-solve-the-error-sort-execution-failure/m-p/484251#M125705</guid>
      <dc:creator>hashman</dc:creator>
      <dc:date>2018-08-06T04:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: how to solve the error: sort execution failure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-solve-the-error-sort-execution-failure/m-p/484491#M125791</link>
      <description>Thank you so much and sorry for the late response</description>
      <pubDate>Mon, 06 Aug 2018 18:58:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-solve-the-error-sort-execution-failure/m-p/484491#M125791</guid>
      <dc:creator>freda</dc:creator>
      <dc:date>2018-08-06T18:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to solve the error: sort execution failure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-solve-the-error-sort-execution-failure/m-p/484492#M125792</link>
      <description>Thank you and sorry for the late reply</description>
      <pubDate>Mon, 06 Aug 2018 18:58:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-solve-the-error-sort-execution-failure/m-p/484492#M125792</guid>
      <dc:creator>freda</dc:creator>
      <dc:date>2018-08-06T18:58:55Z</dc:date>
    </item>
  </channel>
</rss>

