1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| /****************************************************/
/* Stored Process 1651_a */
/****************************************************/
%global _odsdest;
%let _odsdest=excel;
data _null_;
rc=stpsrv_header('Content_type','application/vnd.ms-excel');
rc=stpsrv_header('Content_type','attachment; filename=contrat_motif_sit_mj_migr.xls');
run;
*ProcessBody;
LIBNAME Syst_Prd ODBC DATASRC=SHAM_PROD SCHEMA=systole USER=dwh PASSWORD="{sas001}ZHdo" ;
title "Contrats qui ont un motif situation à « mise à jour migration » ";
ods excel body=_WEBOUT;
proc sql;
select distinct g.lib_groupe_sham, c.id_client, pm.lib_personne_morale, pm.ville, c.numero_contrat,
ec.lib_etat_contrat,count(*) as nb_contrat
from Syst_Prd.con_cod_sit_motif_creation t, Syst_Prd.con_situation s, Syst_Prd.con_contrat c,
Syst_Prd.con_cod_etat_contrat ec, Syst_Prd.cli_client cli, Syst_Prd.cli_personne_morale pm,
Syst_Prd.hab_a_pour_interlocuteur ha, Syst_Prd.hab_groupe g
where t.code_motif_crea_sit = 'M98'
and s.code_motif_crea_sit = t.code_motif_crea_sit
and c.id_contrat = s.id_contrat
and c.code_etat_contrat = ec.code_etat_contrat
and c.id_client = cli.id_client
and cli.id_client = pm.id_client
and c.id_client = ha.id_client
and ha.id_groupe = g.id_groupe
and g.code_type_groupe = 'PROD'
order by g.lib_groupe_sham, c.id_client, pm.lib_personne_morale, pm.ville, c.numero_contrat;
quit;
run;
ods excel close; |
Partager