in a data step I would define an array using the : (colon) suffix to include all the colXX variables and just accumulate the last 3 like
Array cols(*) col: ;
last3 = 0 ;
do idx = dim(cols) to dim(cols)-2;
last3+cols( idx);
end;
Then no matter how many COLxx columns are present only the last 3 are summed
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.