@blacklucas1 wrote:
Hi all - been struggling with this for a little bit and it seems incredibly simple. I've tried a simple left join but it didn't give me the results I was hoping for.
I have a dataset of hospitalizations containing patient identification numbers and various other characteristics.
in the dataset, we have index events hospitalizations for a certain procedure + readmission hospitalizations. Thus, a specific patient ID number has 2 rows of data if they were readmitted (with the latter having readmission=1 and readmitdiagnosis. Values for these variables are null in the index hospitalization row.
How can I collapse these rows so each patient just has one row containing all of their data + readmission, readmitdiagnosis from the latter line?
Thank you in advance for the help.
Before going too far down this path you should consider definition of "readmission" and carefully share that. One concern is that a patient may have multiple readmissions and how to collapse 2 records, as described, will likely have a very poor result for someone with 2, 3, 4 or more readmissions.
Which is run reason to provide example data and what the resulting output should be as @ed_sas_member suggests.
Another bit might be describe what you expect to use that "collapsed" data for. It may well be possible to use your current data without bodging things together.