I am starting think that you may need to reshape your data if the 7, 8, etc are drug codes. Something like: data want (keep=PatientId Quarter DrugCode); /*I'm guessing as to actual variable name of your patient id variable*/ set xx; array q qtr: ; do _i_ = 1 to dim(q); Quarter = _i_; /* this will be the number of the quarter*/ if q[_i_] > 0 then do; /* if your code values within the quarters are not numeric we'll have to work on this*/ DrugCode = q[_i_]; output; end; end; run; proc freq data=want; tables DrugCode * Quarter; run; By looking at the row, colomn and overall percents give either overall or within quarter as well as percentage of quarter receiving drug.
... View more