I think for the four variable case the six anded IFs is probably best. However, if you want to do this unbounded, an array solution is evident; it's more work here than needed but is less work than 10 variables -> 45 ifs.
data want;
set have;
match=0;
array vars var:;
do _t = 1 to dim(vars)-1;
do _u = _t+1 to dim(vars);
if vars[_t] = vars[_u] then match=1;
end;
if match=1 then leave;
end;
run;
This does the same thing as the 6 if's (tests 1 vs 2,3,4, tests 2 vs 3,4, tests 3 vs 4), but in array/loop form.
VAR1 ne VAR2 and VAR1 ne VAR3 and VAR1 ne VAR4 and VAR2 ne VAR3 and VAR2 ne VAR4 and VAR3 ne VAR4- surely there must be a way of collapsing this? - thelatemail