Bonjour tout le monde !
Voilà je cherche à donner un code à mes lignes selon leur date de dernier événement, j'ai écris ceci (et bien d'autres tentatives !) mais rien ne fonctionne...
J'ai essayé avec cotes ('), guillemets (") et même avec un d à la fin ('01/09/2012'd) mais rien n'y fait... Enfin avec des guillemets ça fonctionne mais pas tout à fait correctement, par exemple j'ai une ligne où seg_distr = "* * *", le dernier événement date du "22/09/2008" et la tranche = "35" mais il m'affiche code = "920" (alors que normalement code = "918" dans ce cas).
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 data mag.fichier5; set mag.fichier4; if seg_distr =: 'STAR' and tranche = "35" then code = "914"; else if seg_distr =: 'STAR' and tranche = "65" then code = "915"; else if seg_distr =: 'FRAGILE' and tranche = "35" then code = "916"; else if seg_distr =: 'FRAGILE' and tranche = "65" then code = "917"; else if seg_distr =: '* * *' and Date_Der_EV < '01/09/2012' and tranche = "35" then code = "918"; else if seg_distr =: '* * *' and Date_Der_EV < '01/09/2012' and tranche = "65" then code = "919"; else if seg_distr =: '* * *' and Date_Der_EV > '01/09/2012' and tranche = "35" then code = "920"; else if seg_distr =: '* * *' and Date_Der_EV > '01/09/2012' and tranche = "65" then code = "921"; else if seg_distr =: '* *' and Date_Der_EV < '01/09/2011' and tranche = "35" then code = "922"; else if seg_distr =: '* *' and Date_Der_EV < '01/09/2011' and tranche = "65" then code = "923"; else if seg_distr =: '* *' and Date_Der_EV > '01/09/2011' and tranche = "35" then code = "924"; else if seg_distr =: '* *' and Date_Der_EV > '01/09/2011' and tranche = "65" then code = "925"; else code = "NS"; run;
Help ! Merci !
Partager