BookmarkSubscribeRSS Feed
nkm123
Calcite | Level 5

Is there any processing difference between where statement or where = data set option?

 

Data temp;

set temp1(where = (state = 'NJ');

run;

 

Data temp;

set temp1;

where state = 'NJ';

run;

 

which is better in terms of performance? I know we will get same result but is there any performace improvement if use as datas set option compare to sas statement. 

 

Thanks,

1 REPLY 1
Astounding
PROC Star

There is no difference in speed, and no difference in how the processing takes place.

 

Differences are in the flexibility when using more than one incoming SAS data set.  Examples:

 

data both;

merge a b;

by state;

where gender='M';

run;

 

Now the WHERE statement applies to both incoming data sets, so GENDER must appear in both.  Compare that with:

 

data both;

merge a (where=(gender='M'))  b (where=(age > 21));

by state;

run;

 

By using WHERE as a data set option, separate conditions can be applied to each incoming DATA set.  A stand-alone WHERE statement would not be possible to accomplish the same task.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1 reply
  • 3808 views
  • 1 like
  • 2 in conversation