Hi guys,
I have a dataset like this below:
id type Score
100 A 12
100 A 11
101 B 10
101 A 9
101 C 12
102 B 13
102 B 5
102 B 7
103 A 4
103 C 6
........
...........
and i need to exctract the IDs which have different values of "type". In my case that would be id=101 and 103 but i got no clue how to approach it. Any hints please?
Thx
proc sql ;
select id
from have
group by id
having count(distinct type)>1
;
quit;
proc sql ;
select id
from have
group by id
having count(distinct type)>1
;
quit;
thanks Mohamed_zaki
completly forgot about "distinct"
Thanks a lot!
data want ;
set have;
by id;
retain ttype pflag;
if first.id then do; ttype=type; pflag=0; end;
else if (type ne ttype) and (pflag=0) then do; output; pflag=1;end;
keep id;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.