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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Registration is open
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 lock in 2025 pricing—just $495!