BookmarkSubscribeRSS Feed
Cherry
Obsidian | Level 7

I have some PROC SQL code that has to be terminated due to excessive time(>900 min) when run via PC SAS, but when I run the SQL code in PL/SQL it takes less than five minutes to run. Any suggestion on this?

2 REPLIES 2
DF
Fluorite | Level 6 DF
Fluorite | Level 6

I occassionally have this problem querying Oracle too.  Have you tried running the code in pass-through mode?


SAS seems to do pretty awful things with SQL sometimes.  Pass-thru will essentially have Oracle run your code and do all of the work, meaning it'll also take advantage of indexing and other Oracle optimizations.

proc sql;

connect to oracle (user=user pw=pass path='DBNAME');

create table MyTable as

    select *

    from connection to oracle

    (

        SELECT

        1

        FROM

        DUAL

     );

disconnect from oracle;

quit;

SASJedi
SAS Super FREQ

To get some visibility into what's going on, try the SASTRACE option.  Using this option puts extra info in your log about what portions (if any) of the query are passed to the DB and what was processed in SAS.

Here's a generic program template for you to experiment with:

options sastrace=',,,d' sastraceloc=saslog nostsuffix;

libname MyOra oracle user=UserID password=MyPW

                                 schema=SchemaName;

proc sql;

select *

  from MyOra.some_table_name

   where Date < '26JUN1954'd

;

quit;

Check out my Jedi SAS Tricks for SAS Users

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 2 replies
  • 3263 views
  • 1 like
  • 3 in conversation