%let dossier = C:\mon site\elections_2002 ; /* indiquer ici le dossier de stockage des pages Web et autres graphiques */ /***********************************************************************************/ title ; footnote ; proc sort data = elect2002 ; by ndept descending voix ; run ; data dept2002 ; set elect2002 ; by ndept ; length lien $ 200 ; if first.ndept then num + 1 ; lien = "HREF = 'dept"!!compress(num)!!".htm'"!!compbl(" ALT='"!!translate(ndept," ","'")!!"'") ; if first.ndept ; run ; ods listing close ; ods html path = "&dossier" (url = none) body = "dept1.htm" newfile = page style = barrettsblue ; proc sort data = elect2002 ; by ndept descending pct_voix ; run ; footnote2 "Chiffres : ministère de l'intérieur" ; title1 "1er TOUR DE LA PRESIDENTIELLE 2002" ; proc print data = elect2002 label noobs ; label nom = "Candidat" ndept = "Département" pct_voix = "Pourcentage des votes" voix = "Nombre de voix" ; var nom pct_voix voix ; by ndept ; pageby ndept ; run ; ods html close ; ods html body = "&dossier\en_tete.htm" gpath = "&dossier" (url = none) style = barrettsblue ; goption device = gif ; pattern1 v=s c=cyan ; pattern2 v=s c=red ; pattern3 v=s c=blue ; title2 "Candidat arrivé en tête par département" ; title3 "Cliquez sur un département pour avoir le détail des votes le concernant" ; proc gmap data = dept2002 map = cartes.depf (rename = (dep = dept)); id dept ; choro nom / discrete html = lien coutline = black name = "en_tete" ; run ; quit ; title2 ; ods html close ; data elect2002 ; set elect2002 ; length legende $ 200 ; legende = compbl("ALT = '"!!translate(ndept," ","'")!!"'") ; run ; ods html body = "&dossier\abstention.htm" gpath = "&dossier" (url = none) style = barrettsblue ; goption device = gif ; title2 "Taux d'abstention par département" ; proc sort data = elect2002 out = abst2002 nodupkey ; by ndept ; run ; proc format ; value tranche 0 - .25 = "0 à 25 %" .25 <- .3 = "25 à 30 %" .3 <- high = "30 % et plus" ; run ; pattern1 v=e c=black ; pattern2 v=s c=gray ; pattern3 v=s c=black ; proc gmap data = abst2002 map = cartes.depf (rename = (dep = dept)); id dept ; choro pct_abstention / discrete html = legende name = "abs" ; format pct_abstention tranche. ; run ; quit ; ods html close ; title2 ; proc sql ; create table candidats as select distinct nom as start from elect2002 ; quit ; data candidatsF ; set candidats ; end = start ; length label $ 200 ; fmtname = "posD" ; type = "C" ; label = "Cliquer ici" ; output ; fmtname = "bestD" ; type = "C" ; label = "Cliquer ici" ; output ; fmtname = "worstD" ; type = "C" ; label = "Cliquer ici" ; output ; fmtname = "stats" ; type = "C" ; label = "Cliquer ici" ; output ; fmtname = "cart" ; type = "C" ; label = ""!!start!!"" ; output ; run ; proc sort data = candidatsF ; by fmtname ; run ; proc format cntlin = candidatsF ; run ; ods html body = "&dossier\candidats.htm" style = barrettsblue ; proc sql ; select start label = "Candidat (cliquer sur le nom pour la carte de ses scores)" format = $cart., start label = "Les 5 départements où il est le mieux classé" format = $best., start label = "Les 5 départements où il est le moins bien classé" format = $wors., start label = "Position par département" format = $posd., start label = "Ses statistiques de votes" format = $stat. from candidats ; quit ; ods html close ; proc sort data = elect2002 ; by nom ; run ; proc rank data = elect2002 out = rang2002 descending ; by nom ; var pct_voix ; ranks place ; run ; axis1 major = (number=5) ; ods html path = "&dossier" (url = none) gpath = "&dossier" (url = none) body = "best5_1.htm" newfile = bygroup style = barrettsblue ; title2 "Les 5 départements où il est le mieux classé" ; pattern1 v=s c=green ; proc gchart data = rang2002 ; where place <= 5 ; vbar3d ndept / discrete sumvar = pct_voix type = sum descending raxis = axis1 name = "best1" ; by nom ; label nom = "Candidat" pct_voix = '%age de voix' ndept = "Département" ; run ; quit ; ods html close ; ods html path = "&dossier" (url = none) gpath = "&dossier" (url = none) body = "worst5_1.htm" newfile = bygroup style = barrettsblue ; title2 "Les 5 départements où il est le moins bien classé" ; pattern1 v=s c=red ; proc gchart data = rang2002 ; where place > 90 ; vbar3d ndept / discrete sumvar = pct_voix type = sum ascending raxis = axis1 name = "worst1" ; by nom ; label nom = "Candidat" pct_voix = '%age de voix' ndept = "Département" ; run ; quit ; ods html close ; axis ; proc format ; value rang 1 = "1er" 2 = "2e" 3 = "3e" 4 - 7 = "4e - 7e" 8 - 14 = "8e - 14e" 15 = "avant-dernier" 16 = "dernier" ; run ; proc sort data = elect2002 ; by ndept ; run ; proc rank data = elect2002 out = rangd2002 descending ; var pct_voix ; by ndept ; ranks place ; run ; proc sort data = rangd2002 ; by nom ; run ; data rangd2002 ; set rangd2002 ; length legende $200 ; legende = compbl("ALT='"!!translate(ndept," ","'")!!"'") ; run ; ods html path = "&dossier" (url = none) gpath = "&dossier" (url = none) body = "posD_1.htm" newfile = bygroup style = barrettsblue ; title2 "Position par departement" ; pattern1 v=s c="green" ; pattern2 v=s c="yellow" ; pattern3 v=s c="orange" ; pattern4 v=s c="red" ; pattern6 v=s c="purple" ; pattern7 v=s c="black" ; proc gmap data = rangd2002 map = cartes.depf (rename = (dep = dept)) ; id dept ; choro place / discrete coutline = black html = legende name = "rang1" ; by nom ; label nom = "Candidat" place = "Rang" ; format place rang. ; run ; quit ; ods html close ; proc sort data = elect2002 ; by nom ; run ; proc format ; picture px 0 - 1 = "009,99 %" (mult = 10000) ; run ; ods html path = "&dossier" (url = none) body = "stats1.htm" newfile = bygroup style = barrettsblue ; title2 "Distribution des voix en pourcentage des votes exprimés" ; proc tabulate data = elect2002 ; by nom ; var pct_voix ; table pct_voix = "" * ( min = "Minimum" * f=px. max = "Maximum" * f=px. median = "Médiane" * f=px. mean = "Moyenne" * f=px. cv = "Coefficient de variation" * f=numx5.2 ) ; label nom = "Candidat" ; run ; ods html close ; proc sort data = elect2002 ; by nom ; run ; ods html path = "&dossier" (url = none) body = "carte1.htm" gpath = "&dossier" (url = none) newfile = bygroup style = barrettsblue ; title2 "Scores par departement" ; pattern1 v=s c=GRAYBB ; pattern2 v=s c=GRAY88 ; pattern3 v=s c=GRAY55 ; pattern4 v=s c=GRAY22 ; proc gmap data = elect2002 map = cartes.depf (rename = (dep = dept)) ; id dept ; choro pct_voix / levels = 4 html = legende coutline = black name = "carte1" ; by nom ; label nom = "Candidat" pct_voix = "Pourcentage de voix" ; run ; quit ; ods html close ;