07-13-2016 04:32 PM
I have a table with patient info that has two flag variables, app_flag which indicates the patient had a diagnosis for appendicitis within 30 days of an appendectomy procedure, and chronic_flag which flags those patients that had a diagnosis of a chronic disease within 180 days of an appendectomy procedure. This table will have multiple records for a patient and the two flags may occur in different records. What I want is a table with one row per patient with the two flag variables indicating if they have ever had the flag in any of their records. It is now coming to mind as I write this that maybe a Proc SQL select distinct patid and summing the flag variables (as they are coded 0 and 1).
07-13-2016 04:40 PM
This article has an example of creating a data set with one observation per subject from a data set that has multiple obs per subject.