BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
bhaskarkothavt
Obsidian | Level 7

Hello,

 

I am getting below error message when i am trying to connect Oracle database from SAS Studio using Viya4 (the code ran fine yesterday without any errors though)

 

bhaskarkothavt_0-1715263531314.png

Creating an aggregated table which will return 700 -8000 rows and SQL code is as below

bhaskarkothavt_1-1715263581449.png

 

Could some please help me how to overcome this "Insufficient space".

Best Regards,

Bhaskar

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Something in the data may be using many more records than you expect in the final result.

 

When sorting in general SAS requires about 3 times as much space as the data would occupy as a data set because of use of temporary storage and manipulation.

 

Approaches that may work:

1) Pass-through SQL if all the source tables are in the Oracle database

2) Do the join into a separate table then request the distinct count from that resulting table.

3) reduce the size of alias table A by applying the Where clause in the From instead of after the joins occur (I'm not going to retype everything from a picture, post code as text if you want clearer examples of what the code might look like)

View solution in original post

4 REPLIES 4
ballardw
Super User

Something in the data may be using many more records than you expect in the final result.

 

When sorting in general SAS requires about 3 times as much space as the data would occupy as a data set because of use of temporary storage and manipulation.

 

Approaches that may work:

1) Pass-through SQL if all the source tables are in the Oracle database

2) Do the join into a separate table then request the distinct count from that resulting table.

3) reduce the size of alias table A by applying the Where clause in the From instead of after the joins occur (I'm not going to retype everything from a picture, post code as text if you want clearer examples of what the code might look like)

bhaskarkothavt
Obsidian | Level 7
My apologies for not pasting the sql code in the original request. Here is the code and could you please elaborate what you meant by 1 approach.

Code:
proc sql;
  create table audit_agg as
  select c.course,
   count(distinct a.stuno),
   b.gpaname,
   c.yt
  from uachieve.job_queue_run a
  inner join uachieve.job_queue_subreq b
   on b.jobq_seq_no = a.int_seq_no
  left outer join uachieve.job_queue_course c
   on c.jobq_seq_no = a.int_seq_no
   and c.rtabx = b.rtabx
and c.stabx = b.stabx
where a.userid like '%INMAJRGPA%'
and substr(b.gpaname, 1, 1) = 'P' /*Pathways courses*/
and c.yt = "20&yr.&tm."
group by c.course, b.gpaname, yt;
quit;
ballardw
Super User

You don't show how you connect to Oracle.

Basically it pass-through means writing code that the external data base recognizes and execute it there.

 

An example from the online help

proc sql;
connect to oracle as mycon (user=myusr1
   password=mypwd1 path='mysrv1');

select *
   from connection to mycon
   /* everything in the next set of () are executed in the Oracle data base*/
    (select empid, lastname, firstname,
            hiredate, salary
     from employees where 
          hiredate>='31-DEC-88');

disconnect from mycon;
quit;

IF all of the sets in your query are in the data base then you would use the schema table names as Oracle has them. So all the joining and selection would happen in the Oracle database instead of in the SAS work space.

bhaskarkothavt
Obsidian | Level 7
I followed the approach 2 and it worked without any issues thanks a lot.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Discussion stats
  • 4 replies
  • 389 views
  • 1 like
  • 2 in conversation