Dear SAS users, I am using SAS Enterprise Guide to look at use data for an online patient portal. i have counts of use per quarter over 2.5 years (10 quarters). I would like to code this data into an integer that represents how many quarters a patient used the portal at least once. For example, if a patient used the portal at least once for 7 out of the 10 quarters, I would want to code this as a 7, or if the patient only used this portal once for 3 out of the 10 quarters, this would be coded as a 3. With 10 quarters of data, the amount of combinations possible is exhausting and I'm looking for a code that can automate this process. My dataset looks similar to this: ID Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10
1 3 4 5 0 0 0 3 4 1 0
2 1 1 0 0 0 0 2 6 1 4
3 1 1 1 1 0 0 0 7 1 0 So far, I have been able to code for all possible combinations of quarters with 1 or more counts using the code below. However, this does not allow me to code the possible combinations as integers. data work.sList;
length sList$200;
array _s Q1 -- Q10;
do i=1 to dim(_sum);
if _s(i) > 0 then sList=catx (" and ", sList, vname (_s{i}));
end;
keep sList ID;
run;
proc sql;
create table sCounts as
select sList, count(*) as nbPat
from sList
group by sList;
quit; Your help is greatly appreciated. Best, Stephanie
... View more