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.

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