BookmarkSubscribeRSS Feed
sampsas
Fluorite | Level 6

we have user getting error: "unable to insert into temporary index while processing summary function" while running below query in EG 8.2 SAS 9.4 M7. 

 

proc sql;

create table test as 

select var_1 ,

count (distinct var_2) as var_3,

sum(case when var_4 in (.....)

then var_5=1

else 0 end) as var_6

from xyz

group by var_1;

quit;

 

/*We have tried so far with options ubuffsize=100000 but same error. Current default buffsize is 64k  **/

 

 

 

5 REPLIES 5
Kurt_Bremser
Super User

Are you really working with WORK datasets, or do you read datasets from permanent or remote database libraries?

then var_5=1

puzzles me somewhat, it would mean that you want to assign the boolean result of the comparison as a value to var6.

Patrick
Opal | Level 21

Your then var_5=1 doesn't really make sense because it means that var_6 will always be either 0 or missing. And you even don't write var_5 to your target table ...but the code executes without syntax errors.

You must be not telling us something relevant. Your sample code creates a new table in SAS Work without any indexes but the error message you share mentions indexes. 

Please share code closer to your actual one. I assume you're trying to create a table in a database.

data xyz;
  var_1='a';
  var_2='b';
  var_4='x'; var_5=.; var_6=.;
  output; output;
  var_1='d';
  var_2='e';
  var_4='s'; var_5=.; var_6=.;
  output; output;
  var_1='d';
  var_2='f';
  var_4='x'; var_5=.; var_6=.;
  output;

run;

proc sql;
/*  create table test as */
    select var_1 ,
      count (distinct var_2) as var_3,
      sum
    (
      case 
        when var_4 in ('x') then var_5=1
        else 0 
      end
    )
    as var_6
  from xyz
  group by var_1
  ;
quit;

 

sampsas
Fluorite | Level 6

Thank you so much everyone for input, I can get more details. However, query is same as I mentioned earlier from variable perspective, i put bit info at-least for var_4 value. If something wrong from logic perspective, definitely needs to be fixed to fixed from our end. 

 

To me, it seems user creating temp table reading temp table. 

 

 

proc SQL;
create table test as
select var_1,
count (distinct var_2) as var_3,
sum(case when var_4 in ('ABCD','DEFG','HIJK','LMNO','PQRS','TUVW','XYZA','BCDE','FGHI','JKLM')
then var_5=1
else 0 end) as var_6
from xyz
group by var_1;
quit;
Patrick
Opal | Level 21

@sampsas 

"To me, it seems user creating temp table reading temp table."

Single level names like test are tables in SAS WORK. It's the same like the two level name work.test.

 

SAS WORK is a directory on disk that gets created during SAS invocation and gets deleted during SAS shutdown. In this regards SAS WORK is "temporary" but... tables created in SAS WORK are stored physically on disk. The only difference to permanent tables is that they get deleted automatically when a SAS session ends.

 

The error you share with us is about some temporary index. Nothing in your code shows where such an index would get created or used and that's why there is definitely something else that you don't show us creating this error message.

 

For example: If the source table is actually a view then the error could be caused by something in this view. Because the SQL in the view only gets executed when used, the error only shows in the step where the view gets used but not where it gets defined. 

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1172 views
  • 0 likes
  • 3 in conversation