I have a table "AllProc" that have a unique identifier for every patient (Case.Index.Id) and a variety of resp support each patient received during their admission (BiPAP, etc), 1 = received, 0 = did not receive.
I want to add two new columns to this data table, creating a master table "AllProcMaster". One column "NI_TX" for patients who only received "Non-Invasive" resp support (BiPAP, CPAP), and another column "NO_TX" for patients who received neither non-invasive or invasive support (Intubation). In my actual dataset, I have many more resp procedures, which is why I can't just isolate only "O2" for patients in this "NO_TX" column. This is the code I made, which did not work!
What you have is very close to what I need! Except that the "No_TX" column, the only patient who received no treatment (mean NO bipap, cpap, or intubations) would be patient 1b and 2a (only 1b and 2a should have a "1" in this column"). How would I do this? Thank you so much for your help so far!