filename elect "c:\mon site\elections_2002\2002.txt" ; data elect2002 ; length nom $30 ; retain ndept inscrits votants exprimes ; infile elect dlm=" " scanover missover dsd ; input #2 ndept :$30. #4 @12 inscrits #5 @10 votants / #6 @11 exprimes //// @ ; nom = "MEGRET" ; input @"Mégret " voix ; output ; nom = "LEPAGE" ; input @"Lepage " voix ; output ; nom = "GLUCKSTEIN" ; input @"Gluckstein " voix ; output ; nom = "BAYROU" ; input @"Bayrou " voix ; output ; nom = "CHIRAC" ; input @"Chirac " voix ; output ; nom = "LE PEN" ; input @"Pen " voix ; output ; nom = "TAUBIRA" ; input @"Taubira " voix ; output ; nom = "SAINT-JOSSE" ; input @"Josse " voix ; output ; nom = "MAMERE" ; input @"Mamère " voix ; output ; nom = "JOSPIN" ; input @"Jospin " voix ; output ; nom = "BOUTIN" ; input @"Boutin " voix ; output ; nom = "HUE" ; input @"Hue " voix ; output ; nom = "CHEVENEMENT" ; input @"Chevènement " voix ; output ; nom = "MADELIN" ; input @"Madelin " voix ; output ; nom = "LAGUILLER" ; input @"Laguiller " voix ; output ; nom = "BESANCENOT" ; input @"Besancenot " voix ; output ; run ; data elect2002 ; set elect2002 ; blancs = votants - exprimes ; abstention = inscrits - votants ; pct_votants = votants / inscrits ; pct_abstention = abstention / inscrits ; pct_blancs = blancs / votants ; pct_voix = voix / votants ; format pct: percent7.2 ; run ; proc format cntlout = work.dept ; value $dept "01" = "Ain" "02" = "Aisne" "03" = "Allier" "04" = "Alpes de Haute Provence" "05" = "Hautes-Alpes" "06" = "Alpes-Maritimes" "07" = "Ardèche" "08" = "Ardennes" "09" = "Ariège" "10" = "Aube" "11" = "Aude" "12" = "Aveyron" "13" = "Bouches du Rhône" "14" = "Calvados" "15" = "Cantal" "16" = "Charente" "17" = "Charente-Maritime" "18" = "Cher" "19" = "Corrèze" "2A" = "Corse du Sud" "2B" = "Haute-Corse" "21" = "Côte d'Or" "22" = "Côtes d'Armor" "23" = "Creuse" "24" = "Dordogne" "25" = "Doubs" "26" = "Drôme" "27" = "Eure" "28" = "Eure et Loir" "29" = "Finistère" "30" = "Gard" "31" = "Haute-Garonne" "32" = "Gers" "33" = "Gironde" "34" = "Hérault" "35" = "Ille et Vilaine" "36" = "Indre" "37" = "Indre et Loire" "38" = "Isère" "39" = "Jura" "40" = "Landes" "41" = "Loir-et-Cher" "42" = "Loire" "43" = "Haute-Loire" "44" = "Loire-Atlantique" "45" = "Loiret" "46" = "Lot" "47" = "Lot et Garonne" "48" = "Lozère" "49" = "Maine-et-Loire" "50" = "Manche" "51" = "Marne" "52" = "Haute-Marne" "53" = "Mayenne" "54" = "Meurthe-et-Moselle" "55" = "Meuse" "56" = "Morbihan" "57" = "Moselle" "58" = "Nièvre" "59" = "Nord" "60" = "Oise" "61" = "Orne" "62" = "Pas-de-Calais" "63" = "Puy-de-Dôme" "64" = "Pyrénées-Atlantiques" "65" = "Hautes-Pyrénées" "66" = "Pyrénées-Orientales" "67" = "Bas-Rhin" "68" = "Haut-Rhin" "69" = "Rhône" "70" = "Haute-Saône" "71" = "Saône-et-Loire" "72" = "Sarthe" "73" = "Savoie" "74" = "Haute-Savoie" "75" = "Paris" "76" = "Seine-Maritime" "77" = "Seine-et-Marne" "78" = "Yvelines" "79" = "Deux-Sèvres" "80" = "Somme" "81" = "Tarn" "82" = "Tarn-et-Garonne" "83" = "Var" "84" = "Vaucluse" "85" = "Vendée" "86" = "Vienne" "87" = "Haute-Vienne" "88" = "Vosges" "89" = "Yonne" "90" = "Territoire de Belfort" "91" = "Essonne" "92" = "Hauts de Seine" "93" = "Seine-Saint-Denis" "94" = "Val de Marne" "95" = "Val d'Oise" ; run ; data dept ; set dept ; length ndept $30 ; ndept = translate(left(trim(label)),"-"," ") ; dept = start ; keep ndept dept ; run ; proc sort data = elect2002 ; by ndept ; run ; proc sort data = dept ; by ndept ; run ; data elect2002 ; merge elect2002 dept ; by ndept ; run ;