If you want to use all the observations that are easiest to do with SQL summary functions.
SAS 1 true 0 false. , , - , , MAX( condition ) (.. 1). , , , MIN( condition ) .
data have ;
input x y @@;
cards;
-1 -2 2 -4 3 -4 4 -3
;
proc sql ;
create table want as
select
min(x<0) as ALL_X
, max(x<0) as ANY_X
, min(y<0) as ALL_Y
, max(y<0) as ANY_Y
from have
;
quit;
Obs ALL_X ANY_X ALL_Y ANY_Y
1 0 1 1 1