You would be better off switching to proc report, it has more functionality for these types of things:
http://www2.sas.com/proceedings/forum2008/188-2008.pdf
Also, few tips on code formatting as that code is very hard to read - consistent casing, indentation and such like makes it more readable, see below, and an example of proc report:
ods tagsets.excelxp file="&RETE\&NOME_FILE..XLS" gpath="&RETE\" style=printer
options (frozen_Headers='3' width_fudge='2.2' default_column_width='3' Autofilter='yes' embedded_titles='yes'
suppress_bylines='yes' sheet_interval='bygroup' sheet_label=' ' width_points='1' width_fudge='1'
sheet_name="INSTALLAZIONI 2016" absolute_column_width='30,30,100,100,100,40,100,100,70,100,100,100,100,100,100,100,100,100,100,100,100'
autofit_height='yes');
options missing=' ';
title1 font=calibri h=5 "ANDAMENTO SETTIMANALE OPERATIVITA' CASSEVELOCI (INST.2016)";
proc print data=cv.t08_print noobs label split='*';
label anno='Anno'
mes='Mese'
dt_inizio='Data inzio settimana'
dt_fine='Data fine settimana'
region='Region'
cod_ag='Cod_ag'
ag='Ag'
keyatm= 'KeyATM' ...;
sum tot prelievi tot_ver;
where year(dt_attiv_atm)=2016;
run;
proc report data=cv.t08_print nowd split='~';
columns anno mes dt_inizio dt_fine region ...;
define anno / 'Anno';
define mes / 'Mes';
define total_operazioni / analysis sum 'Total';
run;
... View more