BookmarkSubscribeRSS Feed
eliber
Calcite | Level 5

Hi,

I have two tables, each with about 4-5 million rows of data.

Table A has about 50 columns and table B 2500.

The key is a combination of 4 columns.

 

Using SQL takes about a half hour.

 

Any suggestions on how to speed things up would be greatly appreciated.

Thanks,

Eli

5 REPLIES 5
PeterClemmensen
Tourmaline | Level 20

Can you post your code please?

Kurt_Bremser
Super User

If you have a one-to-many or one-to-one relationship, consider sorting and a data step merge.

2500 columns lets me suspect a design issue; depending on your needs, a longitudinal dataset structure might be better.

Depending on your observation size, you might simply run into the limits of your storage infrastructure.

 

Please supply more details (SQL step code, observation size of your datasets, especially of that with just 50 variables).

Ksharp
Super User
Did you try MERGE ?
Or could try Hash Table if your have big memory .
s_lassen
Meteorite | Level 14

There are things you can do, but half an hour is not that long time for a join like that.

 

If your data is in a DBMS, take a look at the READBUFF libname for dataset option (assuming that you extract all the rows or most of them). If the output data also goes to a DBMS, the INSERTBUFF option can also help. If reading from and writing to SAS, the READBUFF and BUFFNO options may be of value.

 

If your data is sorted by the keys, try using a data step instead of SQL.

 

If you are only accessing a minor portion of the tables, indexes may help.

 

 

 

 

AhmedAl_Attar
Rhodochrosite | Level 12

Ho @eliber 

 

Try the technique found in this paper Hash + Point = Key. it will give you options for your large tables

 

Hope this helps,

Ahmed 

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!

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
  • 5 replies
  • 1575 views
  • 0 likes
  • 6 in conversation