<?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 ERROR: :Error occurred while reading from temporary sort file. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Error-occurred-while-reading-from-temporary-sort-file/m-p/891629#M352222</link>
    <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to run an&amp;nbsp;%MACRO function by using below code,&lt;/P&gt;&lt;PRE&gt;%MACRO Explo(year=);
	PROC SQL;
		CREATE TABLE Patmeasu.Exp3_p5y_&amp;amp;year. AS
		SELECT DISTINCT
		citing1.docdb_family_id_citing,
		citing2.docdb_family_id_citing as docdb_family_id_citing_p5
		FROM
		Patmeasu.Exp1_citing1_&amp;amp;year. as citing1
		JOIN Patmeasu.Exp1_citing2_&amp;amp;year. AS citing2 ON citing1.psn_name_citing = citing2.psn_name_citing
		where citing1.docdb_family_id_citing ^= citing2.docdb_family_id_citing
		group by citing1.appln_filing_date
		having citing2.appln_filing_date between intnx('year', min(citing1.appln_filing_date), -5, 'S') and citing1.appln_filing_date
		;
	QUIT;
%MEND Explo;
%Explo(year=2015)
%Explo(year=2016)&lt;/PRE&gt;&lt;P&gt;the only difference here is year. The problem is this code can produce the table when year=2015, however, the result is "&lt;STRONG&gt;ERROR: :Error occurred while reading from temporary sort file." &lt;/STRONG&gt;when year=2016 (please see detail below).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know what is the reason? Could you please give me some adivce about this? Many thanks in advance.&lt;/P&gt;&lt;PRE&gt;64   %MACRO Explo(year=);
65       PROC SQL;
66           CREATE TABLE Patmeasu.Exp3_p5y_&amp;amp;year. AS
67           SELECT DISTINCT
68           /*citing1.appln_filing_date,*/
69           citing1.docdb_family_id_citing,
70           /*citing2.appln_filing_date as appln_filing_date_p5,*/
71           citing2.docdb_family_id_citing as docdb_family_id_citing_p5
72           FROM
73           Patmeasu.Exp1_citing1_&amp;amp;year. as citing1
74           JOIN Patmeasu.Exp1_citing2_&amp;amp;year. AS citing2 ON citing1.psn_name_citing = citing2.psn_name_citing
75           where citing1.docdb_family_id_citing ^= citing2.docdb_family_id_citing
76           group by citing1.appln_filing_date
77           having citing2.appln_filing_date between intnx('year', min(citing1.appln_filing_date), -5, 'S') and
77 ! citing1.appln_filing_date 
78           ;
79       QUIT;
90   %MEND Explo;
91   %Explo(year=2015)
NOTE: The query requires remerging summary statistics back with the original data.
NOTE: Table PATMEASU.EXP3_P5Y_2015 created, with 1573560725 rows and 2 columns.

NOTE: PROCEDURE SQL used (Total process time):
      real time           1:49:48.18
      cpu time            34:14.93

92   %Explo(year=2016)
NOTE: The query requires remerging summary statistics back with the original data.
&lt;STRONG&gt;ERROR: :Error occurred while reading from temporary sort file.&lt;/STRONG&gt;

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           1:16:36.57
      cpu time            27:30.78&lt;/PRE&gt;</description>
    <pubDate>Wed, 30 Aug 2023 02:53:39 GMT</pubDate>
    <dc:creator>Alexxxxxxx</dc:creator>
    <dc:date>2023-08-30T02:53:39Z</dc:date>
    <item>
      <title>ERROR: :Error occurred while reading from temporary sort file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Error-occurred-while-reading-from-temporary-sort-file/m-p/891629#M352222</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to run an&amp;nbsp;%MACRO function by using below code,&lt;/P&gt;&lt;PRE&gt;%MACRO Explo(year=);
	PROC SQL;
		CREATE TABLE Patmeasu.Exp3_p5y_&amp;amp;year. AS
		SELECT DISTINCT
		citing1.docdb_family_id_citing,
		citing2.docdb_family_id_citing as docdb_family_id_citing_p5
		FROM
		Patmeasu.Exp1_citing1_&amp;amp;year. as citing1
		JOIN Patmeasu.Exp1_citing2_&amp;amp;year. AS citing2 ON citing1.psn_name_citing = citing2.psn_name_citing
		where citing1.docdb_family_id_citing ^= citing2.docdb_family_id_citing
		group by citing1.appln_filing_date
		having citing2.appln_filing_date between intnx('year', min(citing1.appln_filing_date), -5, 'S') and citing1.appln_filing_date
		;
	QUIT;
%MEND Explo;
%Explo(year=2015)
%Explo(year=2016)&lt;/PRE&gt;&lt;P&gt;the only difference here is year. The problem is this code can produce the table when year=2015, however, the result is "&lt;STRONG&gt;ERROR: :Error occurred while reading from temporary sort file." &lt;/STRONG&gt;when year=2016 (please see detail below).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know what is the reason? Could you please give me some adivce about this? Many thanks in advance.&lt;/P&gt;&lt;PRE&gt;64   %MACRO Explo(year=);
65       PROC SQL;
66           CREATE TABLE Patmeasu.Exp3_p5y_&amp;amp;year. AS
67           SELECT DISTINCT
68           /*citing1.appln_filing_date,*/
69           citing1.docdb_family_id_citing,
70           /*citing2.appln_filing_date as appln_filing_date_p5,*/
71           citing2.docdb_family_id_citing as docdb_family_id_citing_p5
72           FROM
73           Patmeasu.Exp1_citing1_&amp;amp;year. as citing1
74           JOIN Patmeasu.Exp1_citing2_&amp;amp;year. AS citing2 ON citing1.psn_name_citing = citing2.psn_name_citing
75           where citing1.docdb_family_id_citing ^= citing2.docdb_family_id_citing
76           group by citing1.appln_filing_date
77           having citing2.appln_filing_date between intnx('year', min(citing1.appln_filing_date), -5, 'S') and
77 ! citing1.appln_filing_date 
78           ;
79       QUIT;
90   %MEND Explo;
91   %Explo(year=2015)
NOTE: The query requires remerging summary statistics back with the original data.
NOTE: Table PATMEASU.EXP3_P5Y_2015 created, with 1573560725 rows and 2 columns.

NOTE: PROCEDURE SQL used (Total process time):
      real time           1:49:48.18
      cpu time            34:14.93

92   %Explo(year=2016)
NOTE: The query requires remerging summary statistics back with the original data.
&lt;STRONG&gt;ERROR: :Error occurred while reading from temporary sort file.&lt;/STRONG&gt;

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           1:16:36.57
      cpu time            27:30.78&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Aug 2023 02:53:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Error-occurred-while-reading-from-temporary-sort-file/m-p/891629#M352222</guid>
      <dc:creator>Alexxxxxxx</dc:creator>
      <dc:date>2023-08-30T02:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: :Error occurred while reading from temporary sort file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Error-occurred-while-reading-from-temporary-sort-file/m-p/891632#M352224</link>
      <description>&lt;P&gt;Did you look at this note in your log?&lt;/P&gt;
&lt;PRE&gt;NOTE: Table PATMEASU.EXP3_P5Y_2015 created, with 1573560725 rows and 2 columns.&lt;/PRE&gt;
&lt;P&gt;Your query has created a table with 1.57 billion rows before most likely running out of space! How many rows does this query normally produce? This is symptomatic of incomplete or incorrect table joining logic.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 03:19:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Error-occurred-while-reading-from-temporary-sort-file/m-p/891632#M352224</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-08-30T03:19:46Z</dc:date>
    </item>
  </channel>
</rss>

