data ae;
input pid visit $ ae $;
cards;
103 visit1 eyedis
125 visit1 eardis
145 visit1 eyedis
178 visit1 eardis
198 visit1 rashes
103 visit2 eardis
113 visit2 eardis
125 visit2 eyedis
178 visit2 rashes
198 visit2 eardis
103 visit3 rahes
113 visit3 eyedis
178 visit3 rashes
210 visit3 eardis
;
proc sql;
select pid from ae where visit='visit1'
intersect
select pid from ae where visit='visit2'
intersect
select pid from ae where visit='visit3';
quit;
proc sql;
select * from ae where pid in
(select pid from ae where visit='visit1'
intersect
select pid from ae where visit='visit2'
intersect
select pid from ae where visit='visit3');
quit;
/*firstvisit*/
proc sql;
select pid from ae where visit='visit1'
except
select pid from ae where visit='visit2'
except
select pid from ae where visit='visit3';
quit;
proc sql;
select * from ae where pid in
(select pid from ae where visit='visit1'
except
select pid from ae where visit='visit2'
except
select pid from ae where visit='visit3');
quit;
/*2nd visit*/
proc sql;
select pid from ae where visit='visit1'
intersect
select pid from ae where visit='visit2'
except
select pid from ae where visit='visit3';
quit;
proc sql;
select * from ae where pid in
(select pid from ae where visit='visit1'
intersect
select pid from ae where visit='visit2'
except
select pid from ae where visit='visit3');
quit;
/*3rdvisit*/
proc sql;
select pid from ae where visit='visit3'
except
select pid from ae where visit='visit2'
except
select pid from ae where visit='visit1';
quit;
proc sql;
select * from ae where pid in
(select pid from ae where visit='visit3'
except
select pid from ae where visit='visit2'
except
select pid from ae where visit='visit1');
quit;
No comments:
Post a Comment