data want;
set have;
if _n_ = 1 then do;
declare hash h(dataset: 'work.have(keep= id status where=(not missing(Status)))');
h.defineKey('id');
h.defineData('status');
h.defineDone();
end;
rc = h.find();
drop rc;
run;
data have;
input id city $ year status @@;
datalines;
1 A 1990 .
1 B 1995 .
1 C 2000 1
1 D 2001 .
2 C 1985 .
2 F 2011 .
3 A 1999 .
3 B 2000 1
3 E 2011 1
3 F 2012 .
;
run;
PROC FREQ data=have;
tables id * status / list missing out=work.count(where=(status NE .));
run;
data want;
merge have count(keep=id /* status */ in=incount);
by id;
if incount then status=1;
run;
/* end of program */
data want;
set have;
if _n_ = 1 then do;
declare hash h(dataset: 'work.have(keep= id status where=(not missing(Status)))');
h.defineKey('id');
h.defineData('status');
h.defineDone();
end;
rc = h.find();
drop rc;
run;
Register Today!
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.