*/analyse en composantes principales/*; data tempville; infile "C:/Users/christine/desktop/SAS/temp.dat" ; input ville $ janv fevr mars avri mai juin juil aout sept octo nove dece; run; proc print; run; proc princomp data=tempville cov plots(ncomp=2)=(pattern(circles=1.0)score); var janv--dece; id ville; run; data ocde; infile "C:/Users/christine/desktop/SAS/ocde.dat"; input pays $ natal chomage a_prim a_sec pib fbcf infl recc m_inf prot nrj ; annee = 1975+2*mod(_n_ - 1, 4); run; proc univariate data=ocde normal plot; var natal--nrj; run; proc sort data=ocde out=tocde; by annee; proc univariate data=tocde plot; var natal--nrj; by annee; run; proc corr data=ocde plots=matrix; var natal--nrj; run; proc princomp data=ocde plots(ncomp=4)=(pattern(circles=1.0)score); var natal--nrj; id pays; run; %acp(ocde,pays,natal--nrj); %gacpbx;%gacpsx; %gacpvx; %gacpix; data p_ocde; set ocde; if pays eq "PO" then poids=0 else ; Poids=1; run; %acp(p_ocde,pays,natal--nrj,poids=poids); %gacpbx;%gacpsx; %gacpvx; %gacpix; %let x=1; %let y=2; data anno; retain xsys ysys ’2’; set coorindq nobs=nind; style=’swiss’; if mod(_n_, 4) ne 1 then delete ; y= prin&y; x= prin&x; text=ident; size=1; run; proc gplot data= coorindq; title; footnote ; axis1 length=14cm; / * attention taille * / axis2 length=8cm; symbol v=dot i=join r=13 height=.5; plot prin&y * prin&x=ident / annotate=anno frame href=0 vref=0 nolegend haxis=axis1 vaxis=axis2; run; goptions reset=all; quit; data ukcomp1 ; infile 'C:/Users/Christine/Desktop/SAS/ukcomp1.dat' dlm='09'x; input RETCAP GEARRAT CAPINT WCFTDT LOGSALE LOGASST CURRAT QUIKRAT NFATAST INVTAST FATTOT PAYOUT WCFTCL; poids=1; run; proc reg data=ukcomp1; model RETCAP=WCFTCL WCFTDT GEARRAT LOGSALE LOGASST NFATAST CAPINT FATTOT INVTAST PAYOUT QUIKRAT CURRAT; run; quit; data ukcomp2 ; infile 'C:/Users/Christine/Desktop/SAS/ukcomp1.dat' dlm='09'x; input RETCAP2 WCFTCL WCFTDT GEARRAT LOGSALE LOGASST NFATAST CAPINT FATTOT INVTAST PAYOUT QUIKRAT CURRAT; poids=0; run; data ukcomp; set ukcomp1 ukcomp2; run; proc princomp data=ukcomp out=comp; var WCFTCL WCFTDT GEARRAT LOGSALE LOGASST NFATAST CAPINT FATTOT INVTAST PAYOUT QUIKRAT CURRAT; weight poids; proc reg data=comp; model retcap=prin1--prin12/selection=rsquare cp best=1; run;quit; proc pls data=ukcomp1 cv=one nfac=10; model retcap=WCFTCL WCFTDT GEARRAT LOGSALE LOGASST NFATAST CAPINT FATTOT INVTAST PAYOUT QUIKRAT CURRAT; run; proc pls data=ukcomp nfac=2; model retcap=WCFTCL WCFTDT GEARRAT LOGSALE LOGASST NFATAST CAPINT FATTOT INVTAST PAYOUT QUIKRAT CURRAT; output out=plstat predicted=ychap; run; */ANOVA/*; data carotte; infile "C:/Users/christine/desktop/SAS/carotte.dat"; input Sol Variete Jour; run; proc glm data=carotte; class Variete Sol; model Jour=Variete Sol variete*Sol; run; quit; title 'Group Comparison Using Input Data Set of Summary Statistics'; data graze; length GrazeType $ 10; input GrazeType $ WtGain @@; datalines; controlled 45 controlled 62 controlled 96 controlled 128 controlled 120 controlled 99 controlled 28 controlled 50 controlled 109 controlled 115 controlled 39 controlled 96 controlled 87 controlled 100 controlled 76 controlled 80 continuous 94 continuous 12 continuous 26 continuous 89 continuous 88 continuous 96 continuous 85 continuous 130 continuous 75 continuous 54 continuous 112 continuous 69 continuous 104 continuous 95 continuous 53 continuous 21 ; run; proc sort; by GrazeType; run; proc means data=graze sum; var WtGain; by GrazeType; output out=newgraze; run; proc print data=newgraze; run; proc ttest data=newgraze; class GrazeType; var WtGain; run; *\qu'est ce que cela produit?\*; title 'One-Mean Comparison Using FREQ Statement'; data read; input score count @@; datalines; 40 2 47 2 52 2 26 1 19 2 25 2 35 4 39 1 26 1 48 1 14 2 22 1 42 1 34 2 33 2 18 1 15 1 29 1 41 2 44 1 51 1 43 1 27 2 46 2 28 1 49 1 31 1 28 1 54 1 45 1 ; run; proc ttest data=read h0=30; var score; freq count; run; *\que fait h0=30?\*; title 'Paired Comparison'; data pressure; input SBPbefore SBPafter @@; datalines; 120 128 124 131 130 131 118 127 140 132 128 125 140 141 135 137 126 118 130 132 126 129 127 135 ; run; proc ttest; paired SBPbefore*SBPafter; run; *\a votre avis, cela sert à quoi?\*; *\importer la base des que vous nommerez des1 \*; proc freq data=des1 ; tables F1 / chisq ; run ; *\que fait-on ici?\*; proc freq data=des1 ; tables F1 / chisq testp=(0.2 0.2 0.1 0.2 0.2 0.1) ; run ; *\et là?\*; *\clustering\* data iris; input SepalLength SepalWidth PetalLength PetalWidth Species @@; label SepalLength='Sepal Length in mm.' SepalWidth ='Sepal Width in mm.' PetalLength='Petal Length in mm.' PetalWidth ='Petal Width in mm.'; symbol = put(species, specname10.); datalines; 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 65 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 25 45 17 3 55 35 13 02 1 67 30 52 23 3 70 32 47 14 2 64 32 45 15 2 61 28 40 13 2 48 31 16 02 1 59 30 51 18 3 55 24 38 11 2 63 25 50 19 3 64 32 53 23 3 52 34 14 02 1 49 36 14 01 1 54 30 45 15 2 79 38 64 20 3 44 32 13 02 1 67 33 57 21 3 50 35 16 06 1 58 26 40 12 2 44 30 13 02 1 77 28 67 20 3 63 27 49 18 3 47 32 16 02 1 55 26 44 12 2 50 23 33 10 2 72 32 60 18 3 48 30 14 03 1 51 38 16 02 1 61 30 49 18 3 48 34 19 02 1 50 30 16 02 1 50 32 12 02 1 61 26 56 14 3 64 28 56 21 3 43 30 11 01 1 58 40 12 02 1 51 38 19 04 1 67 31 44 14 2 62 28 48 18 3 49 30 14 02 1 51 35 14 02 1 56 30 45 15 2 58 27 41 10 2 50 34 16 04 1 46 32 14 02 1 60 29 45 15 2 57 26 35 10 2 57 44 15 04 1 50 36 14 02 1 77 30 61 23 3 63 34 56 24 3 58 27 51 19 3 57 29 42 13 2 72 30 58 16 3 54 34 15 04 1 52 41 15 01 1 71 30 59 21 3 64 31 55 18 3 60 30 48 18 3 63 29 56 18 3 49 24 33 10 2 56 27 42 13 2 57 30 42 12 2 55 42 14 02 1 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 69 32 57 23 3 62 29 43 13 2 74 28 61 19 3 59 30 42 15 2 51 34 15 02 1 50 35 13 03 1 56 28 49 20 3 60 22 40 10 2 73 29 63 18 3 67 25 58 18 3 49 31 15 01 1 67 31 47 15 2 63 23 44 13 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 51 25 30 11 2 57 28 41 13 2 65 30 58 22 3 69 31 54 21 3 54 39 13 04 1 51 35 14 03 1 72 36 61 25 3 65 32 51 20 3 61 29 47 14 2 56 29 36 13 2 69 31 49 15 2 64 27 53 19 3 68 30 55 21 3 55 25 40 13 2 48 34 16 02 1 48 30 14 01 1 45 23 13 03 1 57 25 50 20 3 57 38 17 03 1 51 38 15 03 1 55 23 40 13 2 66 30 44 14 2 68 28 48 14 2 54 34 17 02 1 51 37 15 04 1 52 35 15 02 1 58 28 51 24 3 67 30 50 17 2 63 33 60 25 3 53 37 15 02 1 ; run; *\pourquoi cela ne fonctionne pas?\*; data iris; input SepalLength SepalWidth PetalLength PetalWidth Species @@; label SepalLength='Sepal Length in mm.' SepalWidth ='Sepal Width in mm.' PetalLength='Petal Length in mm.' PetalWidth ='Petal Width in mm.'; datalines; 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 65 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 25 45 17 3 55 35 13 02 1 67 30 52 23 3 70 32 47 14 2 64 32 45 15 2 61 28 40 13 2 48 31 16 02 1 59 30 51 18 3 55 24 38 11 2 63 25 50 19 3 64 32 53 23 3 52 34 14 02 1 49 36 14 01 1 54 30 45 15 2 79 38 64 20 3 44 32 13 02 1 67 33 57 21 3 50 35 16 06 1 58 26 40 12 2 44 30 13 02 1 77 28 67 20 3 63 27 49 18 3 47 32 16 02 1 55 26 44 12 2 50 23 33 10 2 72 32 60 18 3 48 30 14 03 1 51 38 16 02 1 61 30 49 18 3 48 34 19 02 1 50 30 16 02 1 50 32 12 02 1 61 26 56 14 3 64 28 56 21 3 43 30 11 01 1 58 40 12 02 1 51 38 19 04 1 67 31 44 14 2 62 28 48 18 3 49 30 14 02 1 51 35 14 02 1 56 30 45 15 2 58 27 41 10 2 50 34 16 04 1 46 32 14 02 1 60 29 45 15 2 57 26 35 10 2 57 44 15 04 1 50 36 14 02 1 77 30 61 23 3 63 34 56 24 3 58 27 51 19 3 57 29 42 13 2 72 30 58 16 3 54 34 15 04 1 52 41 15 01 1 71 30 59 21 3 64 31 55 18 3 60 30 48 18 3 63 29 56 18 3 49 24 33 10 2 56 27 42 13 2 57 30 42 12 2 55 42 14 02 1 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 69 32 57 23 3 62 29 43 13 2 74 28 61 19 3 59 30 42 15 2 51 34 15 02 1 50 35 13 03 1 56 28 49 20 3 60 22 40 10 2 73 29 63 18 3 67 25 58 18 3 49 31 15 01 1 67 31 47 15 2 63 23 44 13 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 51 25 30 11 2 57 28 41 13 2 65 30 58 22 3 69 31 54 21 3 54 39 13 04 1 51 35 14 03 1 72 36 61 25 3 65 32 51 20 3 61 29 47 14 2 56 29 36 13 2 69 31 49 15 2 64 27 53 19 3 68 30 55 21 3 55 25 40 13 2 48 34 16 02 1 48 30 14 01 1 45 23 13 03 1 57 25 50 20 3 57 38 17 03 1 51 38 15 03 1 55 23 40 13 2 66 30 44 14 2 68 28 48 14 2 54 34 17 02 1 51 37 15 04 1 52 35 15 02 1 58 28 51 24 3 67 30 50 17 2 63 33 60 25 3 53 37 15 02 1 ; run; *\description de la base de donnees\*; *\definir une procedure format qui permet de definir le codage suivant :\*; *\1 pour Setosa, 2 pour Versicolor, 3 pour Virginica \*; *\et l'insérer dans la base precedente pour constituer une base iris2\*; proc cluster data=iris2 method=ward print=15; var petal: sepal:; copy species; run; *\que fait la procedure cluster?\*; *\identifier le role de chacune des commandes et options\*; proc print; run; *\quel est l'interet de cela\*; *\a partir de cette sortie, on souhaite faire une representation graphique, par SAS et par vous-meme\*; *\ donc donner un nom a la base constitue par defaut\*; proc tree ncl=3 out=out; copy petal: sepal: species; run; proc tree data=base1 ncl=3 out=out; copy petal: sepal: species; run; *\cela permet de faire quoi et essayer d'analyser la sortie\*; proc print; run; proc candisc noprint out=can; class cluster; var petal: sepal:; run; *\que se passe t'il?\*; proc candisc data=out noprint out=can; class cluster; var petal: sepal:; run; *\qu'est ce que cette analyse?\*; legend1 frame cframe=ligr cborder=black position=center value=(justify=center); axis1 label=(angle=90 rotate=0) minor=none; axis2 minor=none; proc gplot; plot can2*can1=cluster / frame cframe=ligr legend=legend1 vaxis=axis1 haxis=axis2; run; *\que voit-on?\*; proc freq; tables cluster*species; run; *\qu'est ce que cela a produit?\*; data tirage; do i=1 to 150; a=ranbin(-1,1,2/15); output; keep a; end; run; *\quel est le but du programme?\*; data iris4; set iris; set tirage; run; proc print; run; data iris5; set iris4(where=(a=1)); run; proc print; run; proc cluster data=iris5 method=ward print=15 outtree=base2; var petal: sepal:; copy species; run; data malib.base2; set base2; run; proc print; run; proc tree ncl=3 out=out; copy petal: sepal: species; run;