BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
rakeshvvv
Quartz | Level 8

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
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

View solution in original post

1 REPLY 1
Ksharp
Super User
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

Ready to join fellow brilliant minds for the SAS Hackathon?

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!
What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 705 views
  • 0 likes
  • 2 in conversation