OK.
data d1;
input ID TYPE $ DEP $ DATE :date9.;
format date date9.;
cards;
1234 A CIV 22Jul2011
1234 A MIC 09Jul2011
4321 A CSE 05Aug2011
6874 A ECE 05Jul2011
9848 M ECE 15Jul2011
8977 A ECE 22Jul2011
8977 P EIE 27Jul2011
8956 A EIE 28Sep2011
5656 A CSE 16Sep2011
3265 A CSE 22Sep2011
3265 B CSE 22Sep2011
3265 C CSE 22Sep2011
4456 A SDC 27Sep2011
6546 A MPC 27Jul2011
;
run;
data d2;
input _ID _TYPE $ _DEP $ _DATE :date9.;
obs+1;
format _date date9.;
cards;
1234 A EEE 22Jul2011
1234 A EIE 09Aug2011
5678 A EIE 02Sep2011
9876 A EIE 01Sep2011
4321 A EIE 16Sep2011
4321 C CSE 10Aug2011
6874 A ECE 04Jul2011
9848 P ECE 01Aug2011
9848 . ECE 14Jul2011
9703 P ECE 25Jul2011
8977 A ECE 23Jun2011
8977 C CSE 04Jun2011
8977 P ECE 27Jul2011
8790 P ECE 29Jul2011
7864 A MEC 05Sep2011
7864 P MEC 16Sep2011
7864 P ECE 14Jul2011
;
run;
data want(drop=_: obs );
if _n_ eq 1 then do;
declare hash ha(hashexp:20,ordered:'Y');
declare hiter hi('ha');
ha.definekey('obs');
ha.definedata('obs','_id','_TYPE','_DEP',' _DATE');
ha.definedone();
do until(last);
set d2 end=last;
ha.add();
end;
end;
set d1;
length description $ 100;
description='Missing';
do while(hi.next()=0);
if id=_id then do;
if type ne _type and dep eq _dep and date eq _date then do; description=catx(' ','TYPE not matching has',_type);leave;end;
else if dep ne _dep and type eq _type and date eq _date then do; description=catx(' ','DEP not matching has',_dep);leave;end;
else if date ne _date and dep eq _dep and type eq _type then do; description=catx(' ','DATE not matching has',put(_date,date9.));leave;end;
end;
end;
run;
Ksharp
Finally its working Thank you very much for your time and help.
Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.
Explore Now →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.