Hello - I need help with the array below. I have several variables of interest which I’ve listed out. I want to count the number of visits that are acute care (ED or Hospital) and the number of visits that are not acute care (e.g., Dermatology, Podiatry, Physical Therapy). The 910 patients have a different number of visits. I need to base the 2 count variables on these conditions: if visit is not missing and visit is complete then count as Acute or Other. Right now, my code counts all Acute visits (viz_EDHosp_count) and all other non-Acute visits (viz_Other_count) regardless if the visit is complete or not. Is there a way to adapt the code below to obtain an accurate number of visits for each of the count variables by including if Stat1-Stat125 is complete then count? Thank you so much for your time. Variables of interest Urg1-Urg125: Visit urgency = Acute, Scheduled, Walk-in Stat1-Stat125: Visit status = Complete, Cancel by Provider, Cancel by Patient, No Show Array that I need help with data y; set x; array _u (*) viz1 – viz125; do _n_ =1 to dim(_u); if ^ missing(_u[_n_]) then do; viz_EDHosp_count=sum(viz_EDHosp_count,(_u(_n_)="Acute")); /*To capture acute visits*/ viz_Other_count= sum(viz_Other_count,(_u(_n_) ^= "Acute")); /*To capture nonacute visits such as PT, walk-in to audiology clinic*/ end; end; run;
... View more