You can use Peter's test and the fact that sas can do character loops (in data steps at least, if not in macros):
[pre]
data sample;
input cpt1 $ cpt2 $ cpt3 $ cpt4 $ cpt5$;
do i='D9110','D9310','D9610';
ags + ^^( FIND( catx( '#', of cpt1-cpt5 ), i ) );
end;
put ags=;
cards;
D9110 1100 122 2000 D9110
200 D9610 140 D9110 D9310
3000 D9110 D9230 300 D9110
D9610 3000 7777 7889 D9310
D9110 2333 3333 666 D9610
run;
[/pre]
This way you have all in one place:
- a single list for all test values (in the loop)
- a single list for all test variables (in the concatenation list)
and you can massage the sums or derive ratios any way you want in the data step.