options nocenter formdlim="-" ; data in ; input Y w X1 X2 X3 ; ID = put(_N_,2.0) ; /* récupérer le numéro de la ligne qui est dans _N_ */ cards ; 0 8 1 2 3 0 6 1 2 2 0 9 2 3 3 1 4 2 1 1 1 5 2 2 1 1 3 2 2 2 1 15 3 1 1 0 8 1 1 1 1 9 1 3 3 0 7 1 1 3 1 6 1 3 1 1 3 3 2 1 1 3 3 3 1 ; proc format ; value x1_F 1="X11" 2="X12" 3="X13"; value x2_F 1="X21" 2="X22" 3="X23"; value x3_F 1="X31" 2="X32" 3="X33"; run ; title1 'Etude des fréquences lignes ' ; ods graphics on ; proc freq data=in ; weight w ; table X1*X2 / nopercent nocol cellchi2; format x1 x1_f. x2 x2_F. ; run ; title1 'Etude des fréquences colonnes ' ; proc freq data=in ; weight w ; table X1*X2 / nopercent norow cellchi2; run ; ods graphics on ; *****************************************************************************; * AFC simple X1 * X2 ; *****************************************************************************; title1 'Tableau C1*C2 ' ; proc tabulate data=in; var w; class X1 X2; table (X1 all),(X2 all)*w*sum*F=3.0/ RTS=10; run; title1 'AFC simple ligne x colonne x1*x2 (SCA)' ; Proc corresp data=in OUTC=dat_coord1 DIMENS=2 plots=all; weight w; Tables X1 , X2 ; /* SCA : mettre une virgule entre les variables */ format x1 x1_f. x2 x2_F. ; run ; proc print data=dat_coord1 ; run; *****************************************************************************; * AFC multiple X1 * X2 *X3 ; *****************************************************************************; title1 'Tableau des correspondances multiples (x1,x2,x3)*(x1,x2,x3) ' ; proc tabulate data=in; weight w; class X1 X2 X3; table (X1 X2 X3), (X1 X2 X3)*n*F=3.0/ RTS=10; format x1 x1_f. x2 x2_F. x3 x3_F. ; Run; title1 'AFCM Correspondances multiples (x1,x2,x3)*(x1,x2,x3) (MCA)' ; Proc corresp data=in mca OUTC=dat_coord2 DIMENS=2 ; weight w; Tables X1 X2 X3 ; format x1 x1_f. x2 x2_F. x3 x3_F. ; run ; proc print data=dat_coord2 ; Run; *****************************************************************************; * AFC disjonctif : ID X1 X2 X3 ; *****************************************************************************; title1 'Tableau disjonctif complet ' ; proc tabulate data=in; var w; class ID X1 X2 X3; table (ID all),(w*sum*F=3.0 (X1 X2 X3)*N*F=3.0)/ RTS=10; format x1 x1_f. x2 x2_F. x3 x3_F. ; Run; title1 'AFC Tableau disjonctif complet ' ; Proc corresp data=in OUTC=dat_coord3 DIMENS=3 ; weight w ; Tables id , X1 X2 X3 ; format x1 x1_f. x2 x2_F. x3 x3_F. ; Run ; proc print data=dat_coord3 ; Run; *********************************************************************************; * autre exemple : hébergement vacances selon la CSP ; *********************************************************************************; data in ; do csp=1 to 10; do heb = 1 to 8 ; input w @@ ; output ; end ; end ; cards ; 160 28 0 321 36 141 45 65 35 34 1 178 8 0 4 0 700 354 229 959 185 292 119 140 961 471 633 1580 305 360 162 148 572 537 279 1689 206 748 155 112 441 404 166 1079 178 434 178 92 783 1114 387 4052 497 1464 525 387 65 43 21 294 79 57 18 6 77 60 189 839 53 124 28 53 741 332 327 1789 311 236 102 102 ; proc format ; value heb_F 1="hôtel" 2="locat" 3="propri" 4="parent" 5="amis" 6="tente" 7="villag" 8="divers" ; value csp_f 1="Agriculteur" 2="Salariés" 3="Patrons" 4="Cadre sup" 5="Cadre moy" 6="Employés" 7="Ouvriers" 8="Personnels" 9="Autres actif" 10="Non actifs"; proc freq data=in ; weight w ; table csp*heb / nocol norow nopercent; format csp csp_f. heb heb_f. ; run ; proc freq data=in ; weight w ; table csp*heb / nofreq cellchi2 nocol norow nopercent; format csp csp_f. heb heb_f. ; run ; title1 'AFC simple ligne x colonne CSP*HEBERGEMENT (SCA)' ; Proc corresp data=in OUTC=dat_coord1 DIMENS=2 plots=all; weight w; Tables CSP , HEB ; /* SCA : mettre une virgule entre les variables */ format csp csp_f. heb heb_f. ; run ;