options nocenter ; title1 h=2 j=l "TYPOLOGIE Hiérarchique"; title2 h=1 j=l "Données MM"; footnote1 h=2 j=l 'Master Marketing Paris-Dauphine'; footnote2 h=1 j=l 'Source : Analyse des données appliquée au marketing ' j=r '2007 (c) Pierre Desmet'; data in; input q1-q4 type @@ ; * @@ indique que les variables sont en continu ; i=_N_ ; * création d'un numéro automatique dans i (car _N_ existe dans le système) ; cards ; 50 33 14 02 1 64 28 56 22 3 65 28 46 15 2 67 31 56 24 3 63 28 51 15 3 46 34 14 03 1 69 31 51 23 3 62 22 45 15 2 59 32 48 18 2 46 36 10 02 1 61 30 46 14 2 60 27 51 16 2 65 30 52 20 3 56 25 39 11 2 63 30 55 18 3 58 27 51 19 3 68 32 59 23 3 51 33 17 05 1 57 28 45 13 2 62 34 54 23 3 77 38 67 22 3 63 33 47 16 2 67 33 57 25 3 76 30 66 21 3 49 31 15 02 1 77 26 69 23 3 60 22 50 15 3 54 39 17 04 1 66 29 46 13 2 52 27 39 14 2 60 34 45 16 2 50 34 15 02 1 44 29 14 02 1 50 20 35 10 2 55 24 37 10 2 58 27 39 12 2 47 32 13 02 1 46 31 15 02 1 51 34 15 02 1 50 35 13 03 1 49 31 15 01 1 67 31 47 15 2 54 37 15 02 1 56 30 41 13 2 63 25 49 15 2 61 28 47 12 2 64 29 43 13 2 54 39 13 04 1 51 35 14 03 1 45 23 13 03 1 51 37 15 04 1 52 35 15 02 1 53 37 15 02 1 67 30 50 17 2 63 33 60 25 3 58 28 51 24 3 57 25 50 20 3 68 30 55 21 3 64 27 53 19 3 65 32 51 20 3 ; proc print data=in (obs=5); title3 "1- Lecture "; run; *************** analyse des variables ***************; proc tabulate data=in ; class type ; var q1-q4 ; table (type all),(q1 q2 q3 q4)*(mean std)*F=6.2; title3 "2- Tableau par type "; run; *************** analyse des corrélations des variables ***************; proc corr data=in ; var q1-q4; title3 "3- Corrélations "; run; ************** proc cluster ********************; proc cluster data=in method=ward simple pseudo rsquare ccc outtree=data_tree print=8 ; * ajouter standard pour standardiser les variables ; var q1-q4; copy type; ODS output ClusterHistory=data_history; title3 "5- Typologie hierarchique "; Run; ODS output close; run ; proc print data= data_history ; title3 "Print data_history "; run; proc gplot data=data_history ; symbol1 i=join v=dot ; plot SemipartialRSq*NumberOfClusters RSquared*NumberOfClusters PseudoF*NumberOfClusters PseudoTSq*NumberOfClusters CubicClusCrit*NumberOfClusters; title3 "Stat de choix du nombre de groupes "; run; proc tree data=data_tree Nclusters=3 horizontal out=data_type ; copy q1-q4 type; GOPTIONS HTEXT=; run; proc print data=data_type (obs=10); title3 "5- Impression typologie "; run; proc freq data=data_type ; tables cluster*type; title3 "5- Tableau croisé de la typologie prévu * réel "; run; proc factor data=data_type N=2 method=prin out=data_fact; var q1-q4; title3 "6- Analyse factorielle "; run; proc gplot data=data_fact; symbol1 i=none v=dot ; plot factor2*factor1=type; title3 "4- Graphique Analyse factorielle "; run; data work ; set data_fact; X=factor1 ; Y=factor2; text=_name_ ; size=2; xsys='2'; ysys='2'; if cluster=1 then color='BLUE' ; if cluster=2 then color='RED'; if cluster=3 then color='CYAN'; Label Y='Axe 2' X='Axe 1'; keep X Y Xsys Ysys text size cluster color ; run; Proc gplot data=work; symbol1 i=none v=dot ; plot Y*X=cluster / annotate=work Href=0 Vref=0; Title3 'premier plan factoriel'; run; *==================== recherche des mots cles pour faire les graphiques ; * les mots clés sont dans le "journal" ; * ne pas oublier de mettre "run" pour les ODS; ODS trace on ; proc cluster data=in method=ward ; var q1-q4; run; ODS trace off ; *=============================================;