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,
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.
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.
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.