Proc Import OUT=in0 Datafile= "D:\travail_sync\Cas\Orange\orange.xls" DBMS=EXCEL REPLACE; run; proc print data=in0 ; var E0 C0 TC0 TE0 choix_2 IA; run ; ************************************************************************; * CONTENT pour vérifier la structure d'une table, notamment si importée ; ************************************************************************; Proc Contents data=in0; run ; Data in ; set in0 ; * E0 C0 TC0 TE0 choix_2 IA foyer revenu sexe age garantie1 prix Bonaff achat sens_prix f_casino f_tropicana; * calcul de la moyenne géométrique ; P_ref = exp((log(E0)+log(C0))/2) ; Label E0 ="Expensive" C0 ="Cheap" TC0="Too Cheap" TE0="Too Expensive" choix_2 ="Choix Casino" IA="Intention d achat" /* 1 à 7*/ Foyer="Taille foyer" Revenu="Tranche revenu" Sexe="Sexe" Garantie1="Garantie Satisfait ou Remboursé" Prix="Niveau prix Casino" Bonaff="Bonne affaire" Achat="Achat" sens_prix="Sensibilité au prix" f_casino="Appréciation Casino" f_tropicana="Appréciation Tropicana" ; Proc Format ; Value SoRx 0="Sans" 1="x1" 2="x2" ; Value Non_Ouix 0="Non" 1="Oui" ; Value sexex 1="Homme" 2="Femme" ; run ; **************************************************************************; * mais pb avec les données la 802 est blanche ; * rectifier et refaire l'analyse ; **************************************************************************; **************************************************************************; * Variable NOMINALE binomiale; **************************************************************************; Title1 "Intervalle de confiance d'une proportion"; PROC Freq data=in ; table IA /binomial(level='1') /* choix de la modalité de référence */ alpha=0.05 ; /* choix du risque alpha */ format IA Fnon_ouiX.; run; Title1 "Test d'une proportion / à un seuil"; proc freq data = in; tables IA / binomial(p=.5); exact binomial; **************************************************************************; * Variable ORDINALE ou NOMINALE multinomiale; **************************************************************************; Title1 "Comparaison par rapport à une distribution"; proc freq data=in; table sexe /testp=(50, 50) ; /* la somme doit faire 100 ! */ weight freq; run; *********************************************************************; * redressement sur le groupe de controle 48.33/51.67 ; * prendre les % dans le premier tableau ; * coefficient % voulu / % actuel ; * groupe 1 41.33 58.67 ; * groupe 2 39.67 60.33 ; ********************************************************************; Title1 "Comparaison composition des groupes"; proc freq data=in ; table sexe*garantie1 /chisq norow nopercent; run; data in; set in ; if garantie1=0 then w=1 ; if garantie1=1 and sexe=1 then w= 48.33 / 41.33; if garantie1=1 and sexe=2 then w= 51.67 / 58.67; if garantie1=2 and sexe=1 then w= 48.33 / 39.67; if garantie1=2 and sexe=2 then w= 51.67 / 60.33; choix_2w = choix_2*w; run ; Title1 "Table des poids de redressement"; proc tabulate data=in ; class garantie1 sexe; var w; table garantie1, sexe*w*mean*F=6.3; run ; Title1 "Comparaison composition des groupes (red)"; proc freq data=in ; weight w ; table sexe*garantie1 /chisq norow nopercent; run; Title1 "Effet du redressement sur Choix_2"; proc tabulate data=in ; class sexe garantie1 ; var choix_2 choix_2w; table (garantie1 all),(choix_2 choix_2w)*(sexe all)*mean*F=8.3; run ; **************************************************************************; * Variable ORDINALE comparaison; * Npar1way non paramétrique avec une variable de groupage ; **************************************************************************; Proc Freq data=in ; table choix_2*garantie1 / chisq nopercent nocol norow cumcol; run ; proc Npar1way data=in edf ; class garantie1 ; var choix_2 ; run; **************************************************************************; * Variable QUANTI (métrique ou Ratio); **************************************************************************; Proc Univariate data=in normal; var p_ref ; histogram p_ref / normal ; inset n mean(5.3) std='Std Dev'(5.3) skewness(5.3) / pos = ne header = 'Summary Statistics'; run ; Proc Univariate data=in; var p_ref ; histogram p_ref / lognormal ; run ; title2 'Simple Random Sampling'; proc surveyselect data=in method=srs n=200 out=in_Sample; run; Proc Univariate data=in_sample; var p_ref ; histogram p_ref / lognormal ; run ; Proc Tabulate data=in ; Class Prix garantie1 ; var choix_2 ; Table Prix, garantie1*choix_2*(mean)*F=6.2 ; run ; Title1 "Intervalle de confiance d'une moyenne"; proc Means data=in alpha=0.05 mean std n /* moyenne ecart-type et effectifs */ t prt /* test en t et sa probabilité */ lclm uclm; /* limites de l'intervalle de confiance */ var p_ref; run; Title1 "Test d'une valeur d'une moyenne"; proc ttest data=in H0= 1.92; var p_ref ; run;