Depends on what you want to accomplish. I think that the SAS datastep compiler is reasonably optimized for this kind of processing, meaning that your original statement is probably as efficient as it gets in terms of performance. I think the program will stop checking the following parts as soon as one part of a multiple OR clause has been proven true.
So, if you want fast and dirty, use the construct
if min(of x1-x5)<10 or max(of y1-y5)>10 then...
By "fast and dirty" I mean that this is fast to write, but harder to read than the original statement, and it probably executes a teeny bit slower, as the program will first compare all the variables in each part to each other to find the minimum or maximum, and then compare the result to 10.
If you have a really large number of variables, and you really care about execution time, I would recommend using a macro construct.
One possibility, if you have two groups of variables, prefixed by "X" and "Y", is to use SQL to construct the clauses:
Proc sql noprint;
select cats(name,'<10') into :x_clause separated by ' or '
from dictionary.tables
where memname='<data set name in caps>'
and libname='<library name in caps>'
and name like 'X%';
select cats(name,'>10') into :y_clause separated by ' or '
from dictionary.tables
where memname='<data set name in caps>'
and libname='<library name in caps>'
and name like 'Y%';
quit;
You can then write you IF statement as
if &x_clause or &y_clause then...
But in most cases I would go with the original statement, or the MIN and MAX construct, as others have also suggested. The macro option certainly beats entering 100 variable names by hand, and if you have that many variables the performance improvement may be worthwhile.
... View more