Dear Experts, I need a patient count for the condition based on the cancer occurrence. I'll share the sample dataset and the expected result for your reference. data have;
input ID Date mmddyy10. Inf Cancer;
cards;
123 05/05/2000 1 0
123 08/07/2001 0 1
123 06/07/2002 1 0
159 01/03/2001 1 1
159 02/08/2002 0 1
618 07/07/2005 0 0
618 05/03/2006 1 0
789 06/06/2000 1 0
789 04/02/2001 0 1
789 03/03/2002 1 0
789 03/03/2002 0 0
run; I required 2 different outputs based on 2 conditions to get the patient IDs. Patients who are Infected(Inf=1) after/same date on cancer (cancer=1) Expected Output(IDs 123,159,789). Patients who are Infected(Inf=1) before cancer (cancer=1) Expected Output(IDs 123,789). Kindly suggests a code to get the patient IDs list at the end of the result. Note: The first occurrence of Cancer is matters but not the following occurrence.
... View more