Well, its by using arrays. The longer version is (and this is not tested as you have not provided test data in the form of a datastep so I nothing to work with nor knowledge of structure):
data want;
set have;
array values{3} mar17 apr17 may17;
do i=1 to 3;
if values{i} > 0 then month_count=sum(month_count,1);
end;
run;
... View more