470010001 INITIAL DIAGNOSIS 19054 19047
470010001 INITIAL DIAGNOSIS 19054 19054
470010002 INITIAL DIAGNOSIS 18641 18641
470010002 INITIAL DIAGNOSIS 18641 18683
470010003 INITIAL DIAGNOSIS 18059 18045
470010003 INITIAL DIAGNOSIS 18059 18059
470010005 INITIAL DIAGNOSIS 18133 18124
470010005 INITIAL DIAGNOSIS 18133 18150
470010007 INITIAL DIAGNOSIS 16880 16220
470010007 INITIAL DIAGNOSIS 16880 17853
Hi,
I have the following data with variables id, term, date1, date2 .
I want create a table to select id’s whose date1 is not present in date2. In the above data the id(470001005,470010007) marked in yellow are discrepancy as their date 1 is not present in date2. We need to pull out those kind of records.
The id’s marked in red are good as their date1 is matching atleast one of the date2 for that particular subject.
data have; input id :$20. term & $40. date1 date2; cards; 470010001 INITIAL DIAGNOSIS 19054 19047 470010001 INITIAL DIAGNOSIS 19054 19054 470010002 INITIAL DIAGNOSIS 18641 18641 470010002 INITIAL DIAGNOSIS 18641 18683 470010003 INITIAL DIAGNOSIS 18059 18045 470010003 INITIAL DIAGNOSIS 18059 18059 470010005 INITIAL DIAGNOSIS 18133 18124 470010005 INITIAL DIAGNOSIS 18133 18150 470010007 INITIAL DIAGNOSIS 16880 16220 470010007 INITIAL DIAGNOSIS 16880 17853 ; run; proc sql; create table want as select * from have group by id having sum(date1=date2)=0; quit;
Xia Keshan
data have; input id :$20. term & $40. date1 date2; cards; 470010001 INITIAL DIAGNOSIS 19054 19047 470010001 INITIAL DIAGNOSIS 19054 19054 470010002 INITIAL DIAGNOSIS 18641 18641 470010002 INITIAL DIAGNOSIS 18641 18683 470010003 INITIAL DIAGNOSIS 18059 18045 470010003 INITIAL DIAGNOSIS 18059 18059 470010005 INITIAL DIAGNOSIS 18133 18124 470010005 INITIAL DIAGNOSIS 18133 18150 470010007 INITIAL DIAGNOSIS 16880 16220 470010007 INITIAL DIAGNOSIS 16880 17853 ; run; proc sql; create table want as select * from have group by id having sum(date1=date2)=0; quit;
Xia Keshan
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: