BookmarkSubscribeRSS Feed
JulieM39
Calcite | Level 5

Hello, I'm trying to run what I thought is some quite simple code, but it's taking hours to complete.  I'm trying to create a table in SAS using data from a table in Teradata.  There should be around 26 million rows.  Does anyone have any idea what the problem could be?  I should say that I have only been using SAS for around four weeks and haven't had any training!  I'm used to Oracle SQL.  My code is here:

 

%macro creator;

 

proc sql noprint;

%connect_to_teradata_dna06;

create table TotalData_27NOV18 as

select * from connection to tera

(

select *

from bsp_bd_sd_dna06.kde_cdb_pcust_totaldata_19nov18

);

disconnect from tera;

quit;

%mend;

 

%creator;

 

3 REPLIES 3
Reeza
Super User
Does it work for smaller subsets at all? That's not a huge query and should take less than 20 minutes in my experience so I would be checking your network speeds.

Have you tried using a libname instead of sql pass through?
r_behata
Barite | Level 11

Check if the underlying Teradata table have any partitions or indexes. Your query is going for a full table scan which is not optimal . Consider splitting your query into smaller subsets as suggested by @Reeza . 

 

To check the Underlying partitions/indexes in you table use the syntax

 

Show table <table_name>.

Also I would suggest running a sample query to test the waters  before running query without filters :

 

proc sql noprint;

%connect_to_teradata_dna06;

create table TotalData_27NOV18 as

select * from connection to tera

(

select *

from bsp_bd_sd_dna06.kde_cdb_pcust_totaldata_19nov18

sample 1000
);

disconnect from tera;

quit;

 

JulieM39
Calcite | Level 5

thank you

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 2994 views
  • 1 like
  • 3 in conversation