I have two arrays, year and yearsum. Yearsum is the sum of values for each year. I am trying to create a new row 'Total' and use the yearsum values as the total values. My code works but it's incredibly inefficient. I am not sure if I can use a DO loop because it will generate 10 rows of 'Total'. if last then do;
Variable = 'Total';
year1 = yearsum1;
year2 = yearsum2;
year3 = yearsum3;
year4 = yearsum4;
year5 = yearsum5;
year6 = yearsum6;
year7 = yearsum7;
year8 = yearsum8;
year9 = yearsum9;
year10 = yearsum10;
output;
end; Is there a way to write year{i} = yearsum {i} more efficiently? I did a DO loop for the top portion but I can't apply it to the above code. do i = 1 to 10;
yearsum{i} = sum(yearsum{i}, year{i});
end; End result:
... View more