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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
| %MACRO IDENT;
---------------------------
---------------------------
---------------------------
data ident_hta4 (drop=code_naf2 code_naf) ;
merge
ident_hta3 (in=a)
naf2008 (in=b);
by code_naf;
if a;
attrib code_naf5 length=$5 informat=$5. format=$5. ;
if length(code_naf)=4 then code_naf5 = Code_NAF2;
else code_naf5 =code_naf;
run;
proc sql noprint;
create table year_treatment as
select distinct annee from ident_hta4 ;
quit;
DATA _NULL_ ;
SET year_treatment ;
CALL SYMPUT ('year', compress(annee)) ;
RUN ;
OPTIONS mlogic symbolgen mprint ;
%if &year. <= 2013 %then
%do;
proc sql ;
create table ident_hta5 as select distinct
a.annee,
a.source,
a.no_centre,
a.no_pdm,
a.segment,
a.tarif,
a.option,
a.version,
a.ea,
a.turpe1,
a.ca1,
a.turpe2,
a.ca2,
a.code_NAF5,
b.code_insee,
b.nom_pdm
/*b.localite*/
from ident_hta4 as a
left join
ref_id.Identification as b
on a.source = b.source
and a.annee = input(b.annee, best.)
and a.no_centre = b.centre
and a.no_pdm = b.no_pdm
;
quit ;
%end;
%else
%do;
proc sql ;
create table ident_hta5 as select distinct
a.annee,
a.source,
a.no_centre,
a.no_pdm,
a.segment,
a.tarif,
a.option,
a.version,
a.ea,
a.turpe1,
a.ca1,
a.turpe2,
a.ca2,
a.code_NAF5,
b.code_insee,
b.nom_pdm
/*b.localite*/
from ident_hta4 as a
left join
admin.structure_id_nom_client as b
on a.source = b.source
and a.annee = input(b.annee, best.)
and a.no_centre = b.centre
and a.no_pdm = b.no_pdm
;
quit ;
%end;
/**********************************************/
/* 5 - ENVOIE VERS EXCEL DU TABLEAU CROISE */
/**********************************************/
proc export data = ident_hta5
outfile = "&CHEMIN_ADMIN.\data\Archives\Identification_HTA_C1_&annee1..xls"
dbms=excel2000
replace ;
run ;
%MEND erd_req_ident_hta ;
%erd_req_ident_hta ; |
Partager