Checking That the Dates Are in the Proper Order

It was mentioned earlier that the date of the laboratory test for patient 025 was prior to the date of the adverse event. You should modify your program to detect this. Remembering that dates are just numbers (the number of days from January 1, 1960), you can easily compare the two dates in the last DATA step, as shown in Program 6-8.

Program 6-8. Adding the Condition That the Lab Test Must Follow the Adverse Event
TITLE "Patients with AE of X Who Are Missing Lab Test Entry"; TITLE2 "or the Date of the Lab Test Is Earlier Than the AE Date"; TITLE3 "-------------------------------------------------------"; DATA _NULL_; FILE PRINT; MERGE AE_X(IN=IN_AE) LAB(IN=IN_LAB); BY PATNO; IF NOT IN_LAB THEN ...

Get Cody’s Data Cleaning Techniques Using SAS® Software now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.