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
|
data table1;
input
NumSecu JEH;
datalines;
1851295500065 16
2841124157856 27
;
run;
data table2;
input
NumSecu DateReleveTension Tension;
datalines;
1851295500065 20171104 124
1851295500065 20171108 112
1851295500065 20171111 139
1851295500065 20171116 114
1851295500065 20171121 124
1851295500065 20171124 123
1851295500065 20171126 111
1851295500065 20171205 124
1851295500065 20171206 118
1851295500065 20171207 132
1851295500065 20171213 118
1851295500065 20171215 124
1851295500065 20171218 121
1851295500065 20171223 111
;
run;
proc sort data = table1; by NumSecu; run;
proc sort data = table2; by NumSecu; run;
data table3;
merge table1 table2;
by NumSecu;
num_mois = input(substr(put(DateReleveTension,$8.),5,2),2.);
run;
proc sort data = table3; by NumSecu descending DateReleveTension; run;
/* Tension JEH */
data table3;
set table3;
by NumSecu;
if first.NumSecu then Tension_JEH = Tension;
run;
/* Max tension par mois */
proc sort data = table3; by numsecu num_mois tension; run;
data table3;
set table3;
by numsecu num_mois tension;
if last.num_mois then max_tension = tension;
/* si vous voulez ne garder que la tension maximale de chaque mois pour chaque patient ainsi que la tension_JEH */
if max_tension ne . or Tension_JEH ne . then output;
run;
proc print data = table3; run; |
Partager