I have claims data that I would like to summarize the procedures within a visit (claim num) and the diagnoses for the procedure combinations within a visit. Example of data I have: Patient ID Claim num Procedure Primary diagnosis 123456 1111 COVID RNA test cough 123456 1111 COVID antibody test cough 123456 5555 COVID antibody test cough 777777 4567 COVID RNA test Sore throat 777777 4567 Chest X-ray Cough 888888 1212 COVID antibody test cough Data I want, as a dataset: Procedure combination by claim # Primary diagnosis cough Primary diagnosis sore throat, cough COVID RNA test, COVID antibody test 1 COVID antibody test 2 COVID RNA test, chest X-ray 1 data have; infile datalines delimiter=','; input patient_id $ claim_num $ procedure :$25. primarydiagnosis :$15.; datalines; 123456, 1111, COVID RNA test, cough 123456, 1111, COVID antibody test, cough 123456, 5555, COVID antibody test, cough 777777, 4567, COVID RNA test, Sore throat 777777, 4567, Chest X-ray, cough 888888, 1212, COVID antibody test, cough ;
... View more