BookmarkSubscribeRSS Feed
Cello23
Quartz | Level 8

Hi,

i use proc print to have this result:

 

table_proc_print.JPG

 

I need in the last row (yellow cell) the average of the column "totale" , not the sum. With the function "proc print" is possibile ???

I dont want use proc report beacuse the same value will repeat  blank (es. column Region "REGION CENTRO NORD" the second will be blanck).

 

This is the code:

 



/* ESPORTAZIONE IN EXCEL */
dm 'odsresults; clear';
ods listing close;

/* ODS -- SETTIMANALE (in excel due fogli distinti) (non è possibile inserire grafici) */
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)";
/* TITLE2 '(Richieste totali pervenute - Interazioni con operatore)'; */
proc print   data=CV.T08_PRINT    noobs label split='*';
label Anno = 'Anno' /*30 */
MES = 'Mese' /*30 */
DT_INIZIO = 'Data inzio settimana' /*100 */
DT_FINE = 'Data fine settimana' /*100 */
REGION = 'Region' /*100 */
COD_AG = 'Cod_ag' /*40 */
Ag = 'Ag'  /*100 */
KEYATM= 'KeyATM'  /*100 */
DT_ATTIV_ATM_ = 'DT_installazione' /*70 */
TOT = 'Totale operazioni(media gg)' /*100 */
Confronto_MED = '% Crescita operazioni rispetto media gg mese anno preced. ATM sostituito'   /*100 */

PRELIEVI = 'N° Prelievi(media gg)' /*800 */
crescita_N_PREL = '% Crescita N°prelievi rispetto media gg mese anno preced. ATM sostituito'  

PRELIEVI_IMP = 'Imp Prelievi(media gg)'   /*80 */
crescita_IMP_PREL   = '% Crescita volumi prelievi rispetto media gg mese anno preced. ATM sostituito'   /*100 */

TOT_VER  ='Totale versamenti(media gg)' /*100 */
crescita_VER  = '% Crescita volumi N°versamenti rispetto media gg mese anno preced. ATM sostituito'   /*100 */

TOT_VER LABEL='Imp versamenti contanti(media gg)'  /*100 */
crescita_VER_cont = '% Crescita volumi vers rispetto media gg mese anno preced. ATM sostituito'  /*100 */

MAX_VER  ='N° versamenti con più di 200 banconote' /*100 */
MAX_PREL  ='N° prelevamenti di importo > 750€'; /*100 */;
sum TOT PRELIEVI TOT_VER; 
WHERE YEAR(DT_ATTIV_ATM) = 2016;
run;


ODS TAGSETS.EXCELXP
OPTIONS ( Sheet_Name = "INSTALLAZIONI 2015" );
TITLE1 font=calibri h=5 "ANDAMENTO SETTIMANALE OPERATIVITA' CASSEVELOCI (INST.2015)";
proc print   data=CV.T08_PRINT    noobs label split='*';
label Anno = 'Anno' /*30 */
MES = 'Mese' /*30 */
DT_INIZIO = 'Data inzio settimana' /*100 */
DT_FINE = 'Data fine settimana' /*100 */
REGION = 'Region' /*100 */
COD_AG = 'Cod_ag' /*40 */
Ag = 'Ag'  /*100 */
KEYATM= 'KeyATM'  /*100 */
DT_ATTIV_ATM_ = 'DT_installazione' /*70 */
TOT = 'Totale operazioni(media gg)' /*100 */
Confronto_MED = '% Crescita operazioni rispetto media gg mese anno preced. ATM sostituito'   /*100 */

PRELIEVI = 'N° Prelievi(media gg)' /*800 */
crescita_N_PREL = '% Crescita N°prelievi rispetto media gg mese anno preced. ATM sostituito'  

PRELIEVI_IMP = 'Imp Prelievi(media gg)'   /*80 */
crescita_IMP_PREL   = '% Crescita volumi prelievi rispetto media gg mese anno preced. ATM sostituito'   /*100 */

TOT_VER  ='Totale versamenti(media gg)' /*100 */
crescita_VER  = '% Crescita volumi N°versamenti rispetto media gg mese anno preced. ATM sostituito'   /*100 */

TOT_VER LABEL='Imp versamenti contanti(media gg)'  /*100 */
crescita_VER_cont = '% Crescita volumi vers rispetto media gg mese anno preced. ATM sostituito'  /*100 */

MAX_VER  ='N° versamenti con più di 200 banconote' /*100 */
MAX_PREL  ='N° prelevamenti di importo > 750€'; /*100 */;
 TOT PRELIEVI TOT_VER; 
WHERE YEAR(DT_ATTIV_ATM) = 2015;
run;


ODS TAGSETS.EXCELXP CLOSE;
you have any suggestions please

 

1 REPLY 1
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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; 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1338 views
  • 0 likes
  • 2 in conversation