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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 305 views
  • 0 likes
  • 3 in conversation