Like this?
[pre]
data IN;
input PERIOD 1. NAME : $3. CO : $1. POS : $1. ;
cards;
1 Bob A a
1 Rob B b
1 Mat C c
2 Bob A a
2 Rob D b
2 Mat C c
3 Bob A a
3 Rob D b
3 Mat C d
4 Bob E d
4 Rob D b
4 Mat C d
run;
proc sql;
select a.NAME
,ifc(sum(a.POS ne b.POS and a.CO ne b.CO),'Y','N') as DIF_CO_AND_POS length=1
,ifc(sum(a.POS eq b.POS and a.CO ne b.CO),'Y','N') as DIF_CO_AND_NOTPOS length=1
,ifc(sum(a.POS ne b.POS and a.CO eq b.CO),'Y','N') as DIF_NOTCO_AND_POS length=1
,ifc(sum(a.POS='a' and b.POS='d' and a.CO ne b.CO),'Y','N') as DIF_CO_AND_POS_A_TO_D length=1
from IN a
,IN b
where a.NAME=b.NAME
and a.PERIOD
group by a.NAME;
quit;
DIF_CO_ DIF_CO_AND_ DIF_NOTCO_ DIF_CO_AND_
NAME AND_POS NOTPOS AND_POS POS_A_TO_D
___________________________________________________________
Bob Y N N Y
Mat N N Y N
Rob N Y N N