BookmarkSubscribeRSS Feed
raawan
Calcite | Level 5

WHEN IS IT GOOD TO COMBINE MULTIPLE SAS DATASETS BY MATCHING KEY VALUES??

WITH INDEXES ON KEY VALUES OR WITHOUT INDEXES ON KEY VALUES

3 REPLIES 3
PGStats
Opal | Level 21

sas/sql will do both, but usually be more efficient with indexed keys. sas datastep programming will also do both, but will require prior sorting when datastes are not indexed.

 

Note, using CAPITALS online is considered shouting and not welcomed on a public forum.

PG
raawan
Calcite | Level 5

When combining multiple SAS data sets by matching key values, under which conditions would it be more efficient to use multiple SET statements in a Data Step

A) Each data set contains a large numbers of rows

There are indexes defined for the key(s) being used on both data sets

B) Each data set contains a large numbers of rows

There are no indexes defined on either data set for the keys being used 

C)One data set contains a large numbers of rows

One data set contains a small number of rows 

No indexes are defined for the key(s) being used on either data set

D) One data set contains a large numbers of rows

One data set contains a small number of rows

Indexes are defined for the key(s) being used on the large data set

Kurt_Bremser
Super User

If both datasets are too large to fit into available memory, sorting them and using a merge is most efficient.

If one can fit into memory, creating a format (or multiple formats) or using a hash object is best.

 

Please supply a code example for matching with multiple set statements.

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

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 3 replies
  • 812 views
  • 0 likes
  • 3 in conversation