%macro plotafm(plans=,iam=,ism=,ip=,fiam=,fism=,typer=,id=,graph=O,typed=, van=,vaq=,vsn=,vsq=,cdgam=,cdgsm=,cdgp=,typeconda=,fvan=,fvaq=,fvsn=,fvsq=, fcdgam=,fcdgsm=,typedcdg=,gra=,grs=,data=,fen=); goptions htext=1; %macro nobs(data,nomvar) ; %global &nomvar; data _null_; if 0 then set &data nobs=nbobs; call symput("&nomvar",left(put(nbobs,10.))); stop; run; %mend; %macro tfilt(fi,type); %let tfil=0; %if &type=act %then %do; %if %upcase(%nrbquote(%scan(%superq(fi),1)))=C or %upcase(%nrbquote(%scan(%superq(fi),1)))=Q %then %do; %if %datatyp(%nrbquote(%scan(%superq(fi),2)))=CHAR %then %let tfil=1 ; %end; %else %if %scan(%superq(fi),1)= %then %let tfil=0; %else %let tfil=1; %end; %if &type=sup %then %do; %if %datatyp(%nrbquote(%superq(fi)))=CHAR %then %let tfil=1 ; %if %scan(%superq(fi),1)= %then %let tfil=0; %end; %mend tfilt; %macro testsplotafm; %let fin=; /* Test sur la présence des plans */ %if %scan(&plans,1)= %then %do; title; data _null_; file print; put #10 @10 "*******************************************************************************************"; put @10 "*** ERREUR ! Vous n'avez pas indiqué le(s) plan(s) factoriel(s) dans le paramètre PLANS ***"; put @10 "*******************************************************************************************"; run; %let fin=F; %end; /* Test sur le type de représentation */ %if %upcase(&typer) ne S and %upcase(&typer) ne C and %upcase(&typer) ne Q %then %do; title; data _null_; file print; put #10 @10 "********************************************************************"; put @10 "*** ERREUR ! La valeur '&typer' donnée au paramètre TYPER (type de " @75 "***"; put @10 "*** représentation) devrait être 's', 'c' ou 'q'" @75 "***"; put @10 "********************************************************************"; run; %let fin=F; %end; /* Test sur l'existence de SAS-GRAPH */ %if %sysprod(GRAPH)=0 and %upcase(&graph)=O %then %do; title; data _null_; file print; put #10 @10 "**************************************************************************"; put @10 "*** ATTENTION ! Vous souhaitez utiliser SAS-GRAPH (paramètre GRAPH=O) ***"; put @10 "*** alors que ce module n'est pas disponible ***"; put @10 "**************************************************************************"; run; %let fin=F; %end; /* Tests sur les filtres */ %macro tfiltre2(fil,texte,type); %if %upcase(%superq(&fil)) ne %then %do; %tfilt(%superq(&fil),&type); %if &tfil=1 %then %do; %if &type=act %then %let exemple= 'c 5' ou 'q 7' ; %if &type=sup %then %let exemple= '6' ; title; data _null_; file print; put #10 @10 "******************************************************************************"; put @10 "*** ERREUR ! Le filtre '&&&fil' sur les &texte" @85 "***"; put @10 "*** (paramètre %upcase(&fil)) devrait être de la forme : &exemple" @85 "***"; put @10 "******************************************************************************"; run; %end; %end; %mend tfiltre2; %let tfil=0; %tfiltre2(fiam,individus actifs moyens,act); %if &tfil=1 %then %do;%let fin=F;%end; %tfiltre2(fism,individus supplémentaires moyens,sup); %if &tfil=1 %then %do;%let fin=F;%end; %tfiltre2(fvan,variables actives numériques,act); %if &tfil=1 %then %do;%let fin=F;%end; %tfiltre2(fvaq,variables actives qualitatives,act); %if &tfil=1 %then %do;%let fin=F;%end; %tfiltre2(fvsn,variables supplémentaires numériques,sup); %if &tfil=1 %then %do;%let fin=F;%end; %tfiltre2(fvsq,variables supplémentaires qualitatives,sup); %if &tfil=1 %then %do;%let fin=F;%end; %tfiltre2(fcdgam,centres actifs moyens,act); %if &tfil=1 %then %do;%let fin=F;%end; %tfiltre2(fcdgsm,centres supplémentaires moyens,sup); %if &tfil=1 %then %do;%let fin=F;%end; /* Tests sur les type de données */ %macro ttype2(typ,points); %if %upcase(&&&typ) ne TEMP and %upcase(&&&typ) ne THEM and %upcase(&&&typ) ne TEMPM and %upcase(&&&typ) ne %then %do; title; data _null_; file print; put #10 @10 "********************************************************************"; put @10 "*** ERREUR ! La valeur '&&&typ' donnée au paramètre %upcase(&typ)" @75 "***"; put @10 "*** (type de données relatif aux &points partiels)" @75 "***"; put @10 "*** devrait être ' ', 'temp', 'tempm' ou 'them'" @75 "***"; put @10 "********************************************************************"; run; %let fin=F; %end; %mend ttype2; %ttype2(typed,individus); %ttype2(typedcdg,centres); %mend testsplotafm; %macro param; title;footnote; %let typer=%upcase(&typer); %let graph=%upcase(&graph); %if %upcase(&iam)=O %then %let iam=1;%else %let iam=0; %if %upcase(&ism)=O %then %let ism=1;%else %let ism=0; %if %upcase(&van)=O %then %let van=1;%else %let van=0; %if %upcase(&vsn)=O %then %let vsn=1;%else %let vsn=0; %if %upcase(&vaq)=O %then %let vaq=1;%else %let vaq=0; %if %upcase(&vsq)=O %then %let vsq=1;%else %let vsq=0; %if %upcase(&cdgam)=O %then %let cdgam=1;%else %let cdgam=0; %if %upcase(&cdgsm)=O %then %let cdgsm=1;%else %let cdgsm=0; %if %upcase(&gra)=O %then %let gra=1;%else %let gra=0; %if %upcase(&grs)=O %then %let grs=1;%else %let grs=0; %let ip=%upcase(&ip); %if %upcase(&ip) ne O %then %let ip=N; %let typed=%upcase(&typed); %let fiam=%upcase(&fiam); %let fism=%upcase(&fism); %let fvan=%upcase(&fvan); %let fvaq=%upcase(&fvaq); %let fvsn=%upcase(&fvsn); %let fvsq=%upcase(&fvsq); %let cdgp=%upcase(&cdgp); %if %upcase(&cdgp) ne O %then %let cdgp=N; %let typedcdg=%upcase(&typedcdg); %let fcdgam=%upcase(&fcdgam); %let fcdgsm=%upcase(&fcdgsm); %if &iam ne 1 %then %let fiam=; %if &ism ne 1 %then %let fism=; %if &van ne 1 %then %let fvan=; %if &vaq ne 1 %then %let fvaq=; %if &vsn ne 1 %then %let fvsn=; %if &vsq ne 1 %then %let fvsq=; %if &cdgam ne 1 %then %let fcdgam=; %if &cdgsm ne 1 %then %let fcdgsm=; %global typefiam typefvan typefvaq; %if &graph=O %then %do; %if %sysprod(graph)=1 %then %let graph=O; %if %sysprod(graph) ne 1 %then %let graph=N; %end; %if &graph=O %then %do; goptions ftext='arial' htitle=1.2 htext=1; symbol1 color=blue value=circle; symbol2 color=red value=triangle; %end; %mend param; %macro nbplans; /*** Calcul du nombre de plans factoriels ***;*/ %global nplans; %let i=1; %do %until(&lm=0); %let lm=%length(%scan(&plans,&i," ")); %let i=%eval(&i+1); %end; %let nplans=%eval(&i-2); %do i=1 %to &nplans; %global p&i.axh p&i.axv p&i; %let p&i.axh=%substr(%scan(&plans,&i," "),1,1); %let p&i.axv=%substr(%scan(&plans,&i," "),3,1); %let p&i=%substr(%scan(&plans,&i," "),1,1)_%substr(%scan(&plans,&i," "),3,1); %end; %mend nbplans; %macro indiv(points=); /* Titres */ *** Titre principal ***; title;footnote; %let footnote=1; %if &typed ne TEMP %then %do; title " Représentation des &points moyens" %if &ip=O %then %do; " et partiels" %end; %end; %else %do; title "Représentation des &points partiels" %end; %if &iam=1 and &ism=0 %then " actifs"; %if &iam=0 and &ism=1 %then " supplémentaires"; %if &iam=1 and &ism=1 %then " actifs et supplémentaires"; ; %if &iam=1 and &ism=1 %then %do; %if &typer=S and &graph=N %then %do; footnote "'a'=actifs 's'=supplémentaires"; %let footnote=2; %end; %if (&typer=C or &typer=Q) and &graph=O %then %do; footnote "&points supplémentaires en rouge"; %let footnote=2; %end; %end; *** Type de représentation ***; %if &typer=C %then title2 "proportionnelle à la contribution à l'inertie expliquée par le plan"; %if &typer=Q %then title2 "proportionnelle à la qualité de représentation sur le plan"; ; *** Notes de base de page dans le cas de filtres ***; %if &fiam ne %then %do; %let typefiam=%scan(&fiam,1); %let nbiamt=%scan(&fiam,2); footnote&footnote "&nbiamt &points actifs ayant la plus forte" %if &typefiam=C %then " CTR"; %if &typefiam=Q %then " QLT"; %if &fism= %then %do; ; %end; %else %do; " " %end; %end; %if &fism ne %then %do; %if &fiam= %then %do; footnote&footnote %end; "&fism &points supplémentaires ayant la plus forte QLT"; ; %end; /* Construction (éventuelle) de la table _individus_ */ %if &graph=O or &typer ne S or &fiam ne or &fism ne %then %do; data _individus_; set &data %if &points=individus %then (where=(_typeobs_="ind")); %if &points=centres %then (where=(_typeobs_="cdg")); ; %if &typer ne S or &fiam ne or &fism ne %then %do; %do i=1 %to &nplans; %if &typer=C %then %do; if _type_="act" then taille&i=coord&&p&i.axh**2+coord&&p&i.axv**2; if _type_="sup" then taille&i=0; %end; %if &typer=Q %then %do; taille&i=cos&&p&i.axh+cos&&p&i.axv; %end; %if &typefiam=C %then %do; retain condia&i; if _type_="act" and _groupe_=" " then condia&i=coord&&p&i.axh**2+coord&&p&i.axv**2; if _type_="sup" then condia&i=.; %end; %if &typefiam=Q %then %do; retain condia&i; if _type_="act" and _groupe_=" " then condia&i=cos&&p&i.axh+cos&&p&i.axv; if _type_="sup" then condia&i=.; %end; %if &fism ne %then %do; retain condis&i; if _type_="act" then condis&i=.; if _type_="sup" and _groupe_=" " then condis&i=cos&&p&i.axh+cos&&p&i.axv; %end; %end; %end; %if &graph=O %then %do; length function $ 8; xsys='2'; ysys='2'; position='2'; if _type_="act" then color="blue "; if _type_="sup" then color="red"; function="label"; %end; %end; *** Cas de filtres ***; %if &fiam ne or &fism ne %then %do; data _ngract_; set &data (where=(_typeobs_="gro")); if _type_="act"; run; %nobs(_ngract_,ngract); %let nbism=%eval((&ngract+1)*&fism+1); %let nbiam=%eval((&ngract+1)*%scan(&fiam,2)+1); proc rank data=_individus_ out=_individus_ descending ties=low; var %if &fiam ne %then %do i=1 %to &nplans; condia&i %end; %if &fism ne %then %do i=1 %to &nplans; condis&i %end; ; ranks %if &fiam ne %then %do i=1 %to &nplans; rcondia&i %end; %if &fism ne %then %do i=1 %to &nplans; rcondis&i %end; ; data _individus_; set _individus_; %if &fiam ne %then %do i=1 %to &nplans; if _type_="act" and (rcondia&i=. or rcondia&i ge &nbiam) then coord&&p&i.axv=.; %end; %if &fism ne %then %do i=1 %to &nplans; if _type_="sup" and (rcondis&i=. or rcondis&i ge &nbism) then coord&&p&i.axv=.; %end; %end; *** Cas de représentation d oursins ou de trajectoires ***; %if &typed=THEM %then %do; data _anno1_; set _individus_; function="move"; output; if _groupe_=" " then do; function="swap"; output; end; else do; function="draw2txt"; output; end; data _anno_; set _anno1_ _individus_; %end; %if &typed=TEMP or &typed=TEMPM %then %do; data _anno1_; set _individus_(where=(_groupe_ ne " ")); by _identif_ notsorted; if first._identif_ then function="move"; else function="draw"; data _anno_; set _anno1_ _individus_; %end; %mend indiv; %macro varia; /* Titres */ *** Titre principal ***; title;footnote; %let footnote=1; title " Représentation des variables" %if &van=1 %then " numériques act -"; %if &vsn=1 %then " numériques sup -"; %if &vaq=1 %then " qualitatives act -"; %if &vsq=1 %then " qualitatives sup -"; ; %if (&typer=C or &typer=Q) and &graph=O and %eval((&van+&vaq)*(&vsn+&vsq)) ne 0 %then %do; footnote "Variables supplémentaires en rouge"; %let footnote=2; %end; *** Type de représentation ***; %if &typer=C %then title2 "proportionnelle à la contribution à l'inertie expliquée par le plan"; %if &typer=Q %then title2 "proportionnelle à la qualité de représentation sur le plan"; ; *** Notes de base de page dans le cas de filtres ***; %if &fvan ne %then %do; %let typefvan=%scan(&fvan,1); %let nbvant=%scan(&fvan,2); %let nbvan=%eval(%scan(&fvan,2)+1); footnote&footnote "&nbvant var num act de plus forte" %if &typefvan=C %then " CTR"; %if &typefvan=Q %then " QLT"; %if &fvaq= and &fvsn= and &fvsq= %then %do; ; %end; %else %do; " " %end; %end; %if &fvaq ne %then %do; %let typefvaq=%scan(&fvaq,1); %let nbvaqt=%scan(&fvaq,2); %let nbvaq=%eval(%scan(&fvaq,2)+1); %if &fvan= %then %do; footnote&footnote %end; "&nbvaqt var qual act de plus forte" %if &typefvaq=C %then " CTR"; %if &typefvaq=Q %then " QLT"; %if &fvsn= and &fvsq= %then %do; ; %end; %else %do; " " %end; %end; %if &fvsn ne %then %do; %let nbvsn=%eval(&fvsn+1); %if &fvan= and &fvaq= %then %do; footnote&footnote %end; "&fvsn var num sup de plus forte QLT" %if &fvsq= %then %do; ; %end; %else %do; " " %end; %end; %if &fvsq ne %then %do; %let nbvsq=%eval(&fvsq+1); %if &fvan= and &fvaq= and &fvsn= %then %do; footnote&footnote %end; "&fvsq var qual sup de plus forte QLT" ; %end; /* Construction de la table _variables_ */ data _variables_; set &data(where=(_typeobs_="var")) end=fin; /*%if &graph=O or &typer ne S or &fvan ne or &fvaq ne or &fvsn ne or &fvsq ne %then %do;*/ %if &typer ne S or &fvan ne or &fvaq ne or &fvsn ne or &fvsq ne %then %do; %do i=1 %to &nplans; %if &typer=C %then %do; if _type_="act" then taille&i=ctrbis&&p&i.axh+ctrbis&&p&i.axv; if _type_="sup" then taille&i=0; %end; %if &typer=Q %then %do; taille&i=cos&&p&i.axh+cos&&p&i.axv; %end; %if &typefvan=C %then %do; if _typevar_="an" then condan&i=ctrbis&&p&i.axh+ctrbis&&p&i.axv; else condan&i=.; %end; %if &typefvan=Q %then %do; if _typevar_="an" then condan&i=cos&&p&i.axh+cos&&p&i.axv; else condan&i=.; %end; %if &typefvaq=C %then %do; if _typevar_="aq" then condaq&i=ctrbis&&p&i.axh+ctrbis&&p&i.axv; else condaq&i=.; %end; %if &typefvaq=Q %then %do; if _typevar_="aq" then condaq&i=cos&&p&i.axh+cos&&p&i.axv; else condaq&i=.; %end; %if &fvsn ne %then %do; if _typevar_="sn" then condsn&i=cos&&p&i.axh+cos&&p&i.axv; else condsn&i=.; %end; %if &fvsq ne %then %do; if _typevar_="sq" then condsq&i=cos&&p&i.axh+cos&&p&i.axv; else condsq&i=.; %end; %end; %end; %if &graph=O %then %do; length function $ 8; xsys='2'; ysys='2'; position='2'; if _type_="act" then color="blue "; if _type_="sup" then color="red"; function="label"; %end; /*%end;*/ *** Cercle des corrélations si GRAPH=N ***; %if &graph=N %then %do; output; array num _numeric_; array car $ _character_; if fin then do i=1 to 20; do over num;num=.;end; do over car;car=" ";end; cos=cos(3.141592*i/10); sin=sin(3.141592*i/10); _ident_="*"; drop i; output; end; %end; *** Cas de filtres ***; %if &fvan ne or &fvaq ne or &fvsn ne or &fvsq ne %then %do; proc rank data=_variables_ out=_variables_ descending ties=low; var %if &fvan ne %then %do; %do i=1 %to &nplans; condan&i %end; %end; %if &fvaq ne %then %do; %do i=1 %to &nplans; condaq&i %end; %end; %if &fvsn ne %then %do; %do i=1 %to &nplans; condsn&i %end; %end; %if &fvsq ne %then %do; %do i=1 %to &nplans; condsq&i %end; %end; ; ranks %if &fvan ne %then %do; %do i=1 %to &nplans; rcondan&i %end; %end; %if &fvaq ne %then %do; %do i=1 %to &nplans; rcondaq&i %end; %end; %if &fvsn ne %then %do; %do i=1 %to &nplans; rcondsn&i %end; %end; %if &fvsq ne %then %do; %do i=1 %to &nplans; rcondsq&i %end; %end; ; data _variables_; set _variables_; %if &fvan ne %then %do; %do i=1 %to &nplans; if _typevar_="an" and (rcondan&i=. or rcondan&i ge &nbvan) then coord&&p&i.axv=.; %end; %end; %if &fvaq ne %then %do; %do i=1 %to &nplans; if _typevar_="aq" and (rcondaq&i=. or rcondaq&i ge &nbvaq) then coord&&p&i.axv=.; %end; %end; %if &fvsn ne %then %do; %do i=1 %to &nplans; if _typevar_="sn" and (rcondsn&i=. or rcondsn&i ge &nbvsn) then coord&&p&i.axv=.; %end; %end; %if &fvsq ne %then %do; %do i=1 %to &nplans; if _typevar_="sq" and (rcondsq&i=. or rcondsq&i ge &nbvsq) then coord&&p&i.axv=.; %end; %end; %end; *** Tracés si GRAPH=O ***; %if &graph=O %then %do; goptions ftext="Arial" vpos=40 hpos=70; axis1 offset=(2,2) order=(-1 to 1 by 0.25) length=8 cm; axis2 offset=(2,2) order=(-1 to 1 by 0.25) length=8 cm; data _anno1_; set _variables_(obs=2); _typevar_=" "; if _n_=1 then do; array _num1_ _numeric_; do over _num1_;_num1_=0;end; function="move"; output; end; if _n_=2 then do; array _num2_ _numeric_; do over _num2_;_num2_=0;end; function="swap"; output; end; data _anno2_; set _variables_; function="move"; output; function="draw2txt"; output; data _anno3_; set _variables_(obs=1); _typevar_=" "; function="pie"; array num _numeric_; do over num;num=0;end; hsys="2"; ysys="2"; color="black"; rotate=360; line=0; size=1; data _anno_; set _anno1_ _anno2_ _variables_ _anno3_; %end; %mend varia; %macro plotvaria; %if &graph=O and &vaq=0 and &van=0 %then %do; symbol1 color=red value=triangle; %end; %let actsup=%eval((%eval(&vaq)+%eval(&van))*(%eval(&vsq)+%eval(&vsn))); %if &graph=N %then proc plot; %if &graph=O %then proc gplot; data=_variables_ (where=(_typevar_=" " or %if &vaq=1 %then %do;%str(_typevar_="aq" or ) %end; %if &van=1 %then %do;%str(_typevar_="an" or ) %end; %if &vsq=1 %then %do;%str(_typevar_="sq" or ) %end; %if &vsn=1 %then %do;%str(_typevar_="sn" or ) %end; 0)); %do i=1 %to &nplans; %if (&typer=C or &typer=Q) and &graph=O %then bubble ; %else plot ; coord&&p&i.axv*coord&&p&i.axh %if &graph=N %then $_ident_; %if &actsup ne 0 and &typer=S %then =_type_; %if &typer=C or &typer=Q %then =taille&i; %if &graph=N %then cos*sin$_ident_; / %if &graph=N %then overlay; %if (&typer=C or &typer=Q) and &graph=N %then contour=5; %if &graph=O %then %do; annotate=_anno_ (where=((_typevar_=" " or %if &vaq=1 %then %do;%str(_typevar_="aq" or ) %end; %if &van=1 %then %do;%str(_typevar_="an" or ) %end; %if &vsq=1 %then %do;%str(_typevar_="sq" or ) %end; %if &vsn=1 %then %do;%str(_typevar_="sn" or ) %end; 0) and y ne .) rename=(_ident_=text coord&&p&i.axh=x coord&&p&i.axv=y)) %if &typer=C or &typer=Q %then %do; %if (%eval(&vsn+&vsq)=0 or &typer=C) %then bcolor=blue; %else %if %eval(&van+&vaq)=0 %then bcolor=red; %else bcolor=green; %end; haxis=axis1 vaxis=axis2 %end; href=0 vref=0; label coord&&p&i.axh="axe &&p&i.axh" coord&&p&i.axv="axe &&p&i.axv"; run; %end; quit; %mend plotvaria; %macro plotindiv(points=); %if &graph=O and &iam=0 %then %do; symbol1 color=red value=triangle; %end; %if &graph=N %then proc plot; %if &graph=O %then proc gplot; %if &typer=S and &graph=N and &fiam= and &fism= %then %do; data=&data %if &points=individus %then (where=(_typeobs_="ind" and; %if &points=centres %then (where=(_typeobs_="cdg" and; %end; %else data=_individus_(where=(; %if &ip=N %then _groupe_=" " and; %if &typed=TEMP %then _groupe_ ne " " and; ( %if &iam=1 %then %do;%str(_type_="act" or ) %end; %if &ism=1 %then %do;%str(_type_="sup" or ) %end; 0))); %do i=1 %to &nplans; %if (&typer=C or &typer=Q) and &graph=O %then bubble ; %else plot ; coord&&p&i.axv*coord&&p&i.axh %if &graph=N %then $_ident_; %if &iam=1 and &ism=1 and &typer=S %then =_type_; %if &typer=C or &typer=Q %then =taille&i; / %if (&typer=C or &typer=Q) and &graph=N %then contour=5; %if &graph=O %then %do; annotate= %if &typed=THEM or &typed=TEMP or &typed=TEMPM %then _anno_; %else _individus_; (where=( %if &typed=TEMP %then _groupe_ ne " " and; y ne . and %if %upcase(&ip)=N %then _groupe_=" " and; ( %if &iam=1 %then %do;%str(_type_="act" or ) %end; %if &ism=1 %then %do;%str(_type_="sup" or ) %end; 0)) rename=(_ident_=text coord&&p&i.axh=x coord&&p&i.axv=y)) %if &typer=C or &typer=Q %then %do; %if &iam=1 and &ism=0 %then bcolor=blue; %if &iam=0 and &ism=1 %then bcolor=red; %if &iam=1 and &ism=1 and &typer=C %then bcolor=blue; %if &iam=1 and &ism=1 and &typer=Q %then bcolor=green; %end; %end; href=0 vref=0; label coord&&p&i.axh="axe &&p&i.axh" coord&&p&i.axv="axe &&p&i.axv"; run; %end; quit; %mend plotindiv; %macro centres; %let iam=&cdgam; %let ism=&cdgsm; %let ip=&cdgp; %let fiam=&fcdgam; %let fism=&fcdgsm; %let typed=&typedcdg; %indiv(points=centres); %plotindiv(points=centres); %mend centres; %macro grou; /* Titres */ *** Titre principal ***; title;footnote; %let footnote=1; %if &gra=1 and &grs=0 %then %do; title " Représentation des groupes actifs"; %end; %if &gra=1 and &grs=1 %then %do; title " Représentation des groupes actifs et supplémentaires"; %if &typer=S and &graph=N %then %do; footnote "'a'=actifs 's'=supplémentaires"; %end; %if (&typer=C or &typer=Q) and &graph=O %then %do; footnote "groupes supplémentaires en rouge"; %end; %end; %if &gra=0 and &grs=1 %then %do; title " Représentation des groupes supplémentaires"; %end; *** Type de représentation ***; %if &typer=C %then %do; title2 "proportionnelle à la contribution à l'inertie expliquée par le plan"; %end; %if &typer=Q %then %do; title2 "proportionnelle à la qualité de représentation sur le plan"; %end; /* Construction (éventuelle) de la table _groupes_ */ %if &graph=O or &typer ne S %then %do; data _groupes_; set &data(where=(_typeobs_="gro")); %if &typer ne S %then %do; %do i=1 %to &nplans; %if &typer=C %then %do; if _type_="act" then taille&i=(coord&&p&i.axh+coord&&p&i.axv) /(&&&&valp&&p&i.axh+&&&&valp&&p&i.axv)*100; if _type_="sup" then taille&i=0; %end; %if &typer=Q %then %do; taille&i=cos&&p&i.axh+cos&&p&i.axv; %end; %end; %end; %if &graph=O %then %do; length function $ 8; xsys='2'; ysys='2'; position='2'; if _type_="act" then color="blue "; if _type_="sup" then color="red"; function="label"; %end; %end; %mend grou; %macro plotgrou; %if &graph=O %then %do; axis3 offset=(2,2) order=(0 to 1 by 0.10) length=10 cm; axis4 offset=(2,2) order=(0 to 1 by 0.10) length=10 cm; %if &gra=0 %then %do; symbol1 color=red value=triangle; %end; %end; %if &graph=N %then proc plot; %if &graph=O %then proc gplot; %if &typer=S and &graph=N %then data=&data(where=(_typeobs_="gro")); %else data=_groupes_; (where=( %if &gra=1 %then %do;%str(_type_="act" or ) %end; %if &grs=1 %then %do;%str(_type_="sup" or ) %end; 0)); %do i=1 %to &nplans; %if (&typer=C or &typer=Q) and &graph=O %then bubble ; %else plot ; coord&&p&i.axv*coord&&p&i.axh %if &graph=N %then $_groupe_; %if &gra=1 and &grs=1 and &typer=S %then =_type_; %if &typer=C or &typer=Q %then =taille&i; / %if (&typer=C or &typer=Q) and &graph=N %then contour=5; %if &graph=O %then %do; haxis=axis3 vaxis=axis4 annotate=_groupes_ (where=( y ne . and %if &gra=1 %then %do;%str(_type_="act" or ) %end; %if &grs=1 %then %do;%str(_type_="sup" or ) %end; 0) rename=(_groupe_=text coord&&p&i.axh=x coord&&p&i.axv=y)) %if &typer=C or &typer=Q %then %do; %if &gra=1 and &grs=0 %then bcolor=blue; %if &gra=0 and &grs=1 %then bcolor=red; %if &gra=1 and &grs=1 and &typer=C %then bcolor=blue; %if &gra=1 and &grs=1 and &typer=Q %then bcolor=green; %end; %end; %if &graph ne O %then href=0 vref=0; ; label coord&&p&i.axh="axe &&p&i.axh" coord&&p&i.axv="axe &&p&i.axv"; run; %end; quit; %mend plotgrou; %macro fenplotafm; %let findial=n; %let fin=; %let graph=o; /* Récupération des valeurs des paramèytres */ %let EXIST=O; %let EXIST=%sysfunc(exist(_paramplotafm_)); %if &EXIST>0 %then %do; data _null_; set _paramplotafm_; call symput(NPAR,VPAR); run; %end; /* Affichage de la fenêtre */ %window GRAPH color=grey #2 @5 "*** EDITION DE GRAPHIQUES ILLUSRANT LES RESULTATS D'UNE ANALYSE FACTORIELLE MULTIPLE ***" color=yellow #4 @2 "Nom de la table SAS en sortie de la macro AFMULT : " DATA 40 color=red attr=underline auto=yes #7 @2 "TYPES DE POINTS A REPRESENTER" color=green attr=underline " ("color=green "o" color=red " = oui), " color=green "FILTRES" color=green attr=underline " ("color=green"*"color=red")," color=green " et " color=green "TYPE DE DONNEES " color=green attr=underline "("color=green"**"color=red ") : " color=green #9 @4 "INDIVIDUS" color=blue attr=underline" - actifs moyens : " IAM 1 color=red attr=underline auto=yes @55 " Filtre : " color=blue FIAM 3 color=red attr=underline auto=yes #10 @4 " - supplémentaires moyens : " ISM 1 color=red attr=underline auto=yes @55 " Filtre : " color=blue FISM 1 color=red attr=underline auto=yes #11 @4 " - partiels correspondants : " IP 1 color=red attr=underline auto=yes #12 @6 "Type de données :"color=blue attr=underline" " TYPED 5 color=red attr=underline auto=yes #14 @4 "VARIABLES" color=blue attr=underline" - actives numériques : " VAN 1 color=red attr=underline auto=yes @55 " Filtre : " color=blue FVAN 3 color=red attr=underline auto=yes #15 @4 " - actives qualitatives : " VAQ 1 color=red attr=underline auto=yes @55 " Filtre : " color=blue FVAQ 3 color=red attr=underline auto=yes #16 @4 " - supplémentaires numériques : " VSN 1 color=red attr=underline auto=yes @55 " Filtre : " color=blue FVSN 1 color=red attr=underline auto=yes #17 @4 " - supplémentaires qualitatives : " VSQ 1 color=red attr=underline auto=yes @55 " Filtre : " color=blue FVSQ 1 color=red attr=underline auto=yes #19 @4 "CENTRES DE GRAVITE"color=blue attr=underline" - actifs moyens : " CDGAM 1 color=red attr=underline auto=yes @55 " Filtre : " color=blue FCDGAM 3 color=red attr=underline auto=yes #20 @4 " - supplémentaires moyens : " CDGSM 1 color=red attr=underline auto=yes @55 " Filtre : " color=blue FCDGSM 1 color=red attr=underline auto=yes #21 @4 " - partiels correspondants : " CDGP 1 color=red attr=underline auto=yes #22 @6 "Type de données :"color=blue attr=underline" " TYPEDCDG 5 color=red attr=underline auto=yes #24 @4 "GROUPES " color=blue attr=underline" - actifs : " GRA 1 color=red attr=underline auto=yes #25 @4 " - supplémentaires : " GRS 1 color=red attr=underline auto=yes #33 @4 "(" color= green "*" color=red ") "color=green "FILTRES:" color=green attr= underline " (optionnels)" color=green #34 @7 " . " "Pour les éléments actifs" color=black attr=underline ":" #35 @10 "ex:" attr=underline @13 " -" color=black " c 5" color=red " sélectionne les 5 points ayant la plus forte contribution " color=black "à l'inertie du plan" color=black #36 @13 " -" color=black " q 7" color=red " sélectionne les 7 points ayant la meilleure qualité" color=black " de représentation sur le plan" color=black #37 @8 ". " "Pour les éléments supplémentaires" color=black attr=underline " : " "6" color=red " sélectionne les 6 points ayant la meilleure qualité" color=black #39 @3 "(" color= green "**" color=red ") "color=green "TYPE DE DONNEES:" color=green attr=underline" (nécessaire pour tracer les segments" color=green " en présence de points ""partiels"") : " color=green #40 @10 "them" color=red " = thématiques, " color=black "temp" color=red " = temporelles " color=black "ou " "tempm" color=red " = temporelles + individus moyens" color=black #27 @2 "Liste des plans factoriels :" color=blue attr=underline " (" "ex" attr=underline" :" " 1-2 1-3" color=green ")" " "PLANS 40 color=red attr=underline auto=yes #29 @2 "Type de représentation :" color=blue attr=underline " " TYPER 1 color=red attr=underline auto=yes " " "où" @34 "s " color=red "= simple, " color=black #30 @34 "c " color=red "= proportionnelle à la contribution à l'inertie " color=black #31 @34 "q " color=red "= proportionnelle à la qualité de la représentation" color=black #5 @2 "Souhaitez-vous utiliser le module SAS-GRAPH ? : " color=black GRAPH 1 color=red attr=underline auto=yes #43 @2 "Pour quitter l'écran, positionnez le curseur ici ---> " color=magenta FIN 1 color=blue attr=rev_video auto=yes #44 @2 "Si vous souhaitez :" color=magenta attr=underline " - EXECUTER la macro : tapez e" color=magenta #45 @2 " - Mettre fin au dialogue : tapez f" color=magenta #46 @2 "Tout autre caractère vous renverra en haut de l'écran." color=magenta; %graph:; %display GRAPH; /* Quitter sans valider */ %if %upcase(&fin)=F %then %goto fin; /* Exécuter */ %else %if %upcase(&fin)=E %then %goto suite; /* Autres cas : on reste sur l'écran */ %else %do; %let fin=; %goto graph; %end; %suite:; /* Test sur la présence du paramètre &DATA */ %do %while(%scan(&data,1)= ); %window ERREUR color=grey icolumn=5 columns=100 rows=15 #4 @4 "ERREUR ! La table contenant les sorties de la macro AFMULT" color=green " doit être spécifiée" color=green #7 @4 "Tapez sur Entrée pour continuer" color=green; %display ERREUR; %goto graph; %end; /* Test sur l'allocation de la librairie &DATA */ %if %index(&data,.) ne 0 %then %do; %let LIBR=0; %let LIBR=%sysfunc(libref(%SCAN(&DATA,1,.))); %if &LIBR NE 0 %then %do; %window ERREUR color=grey icolumn=5 columns=60 rows=16 #4 @4 "La librairie" color=green " %SCAN(&DATA,1,.)" color=red " n'est pas allouée" color=green #7 @4 "Tapez sur Entrée pour continuer" color=green; %display ERREUR; %goto graph; %end; %end; /* Test sur l'existence de la table &DATA */ %let tid=%sysfunc(exist(&data)); %if &tid=0 %then %do; %window ERREUR color=grey icolumn=5 columns=60 rows=16 #4 @4 "La table " color=green "&data" color=red " contenant les sorties de la macro AFMULT" color=green " n'existe pas." color=green #7 @4 "Tapez sur Entrée pour continuer." color=green; %display ERREUR; %goto graph; %end; %macro tfiltre(fil,texte,color1,color2,type); %if %upcase(%superq(&fil)) ne %then %do; %let i=1; %tfilt(%superq(&fil),&type); %if &type=act %then %let exemple="c 5" color=&color2 " ou " color=&color1 "q 7" color=&color2; %if &type=sup %then %let exemple="6" color=&color2; %do %while(&tfil=1 and &i<3); %window ERREUR color=grey icolumn=5 columns=100 rows=15 #4 @4 "ERREUR ! Le filtre" color=&color1 " &&&fil " color=&color2 "sur les &texte devrait être de la forme " color=&color1 &exemple #7 @4 "Tapez sur Entrée pour continuer" color=&color1; %display ERREUR; %display GRAPH; %tfilt(%superq(&fil),&type); %let i=%eval(&i+1); %end; %end; %mend tfiltre; %let tfil=0; %tfiltre(fiam,individus actifs moyens,green,red,act); %if &tfil=1 %then %do;%let fin=F;%goto fin;%end; %tfiltre(fism,individus supplémentaires moyens,green,red,sup); %if &tfil=1 %then %do;%let fin=F;%goto fin;%end; %tfiltre(fvan,variables actives numériques,green,red,act); %if &tfil=1 %then %do;%let fin=F;%goto fin;%end; %tfiltre(fvaq,variables actives qualitatives,green,red,act); %if &tfil=1 %then %do;%let fin=F;%goto fin;%end; %tfiltre(fvsn,variables supplémentaires numériques,green,red,sup); %if &tfil=1 %then %do;%let fin=F;%goto fin;%end; %tfiltre(fvsq,variables supplémentaires qualitatives,green,red,sup); %if &tfil=1 %then %do;%let fin=F;%goto fin;%end; %tfiltre(fcdgam,centres actifs moyens,green,red,act); %if &tfil=1 %then %do;%let fin=F;%goto fin;%end; %tfiltre(fcdgsm,centres supplémentaires moyens,green,red,sup); %if &tfil=1 %then %do;%let fin=F;%goto fin;%end; /* Test sur la présence des plans */ %let i=1; %do %while(%scan(&plans,1)= and &i<3); %window ERREUR color=grey icolumn=5 columns=100 rows=15 #4 @4 "ERREUR ! Vous n'avez pas indiqué le(s) plan(s) factoriel(s)" color=green #7 @4 "Tapez sur Entrée pour continuer" color=green; %display ERREUR; %display GRAPH; %let i=%eval(&i+1); %end; %if %scan(&plans,1)= %then %do; %let fin=F; %goto fin; %end; /* Tests sur les type de données */ %macro ttype(typ,points); %let i=1; %do %while(%upcase(&&&typ) ne TEMP and %upcase(&&&typ) ne THEM and %upcase(&&&typ) ne TEMPM and %scan(&&&typ,1) ne and &i<3); %window ERREUR color=grey icolumn=5 columns=100 rows=15 #4 @4 "ERREUR ! La valeur " color=green "&&&typ" color=red " donnée au paramètre type de données relatif aux &points partiels" color=green #5 @13 "devrait être : ' ', " color=green "temp" color=red ", " color=green "tempm" color=red " ou " color=green "them" color=red #7 @4 "Tapez sur Entrée pour continuer" color=green; %display ERREUR; %display GRAPH; %let i=%eval(&i+1); %end; %mend ttype; %ttype(typed,individus);%if &i=3 %then %do; %let fin=F; %goto fin; %end; %ttype(typedcdg,centres);%if &i=3 %then %do; %let fin=F; %goto fin; %end; /* Test sur le type de représentation */ %let i=1; %do %while(%upcase(&typer) ne S and %upcase(&typer) ne C and %upcase(&typer) ne Q and &i<3); %window ERREUR color=grey icolumn=5 columns=100 rows=15 #4 @4 "ERREUR ! La valeur " color=green "&typer" color=red " donnée au paramètre type de représentation" color=green " devrait être : " color=green "s" color=red ", " color=green "c" color=red " ou " color=green "q" color=red #7 @4 "Tapez sur Entrée pour continuer" color=green; %display ERREUR; %display GRAPH; %let i=%eval(&i+1); %end; %if &i=3 %then %do; %let fin=F; %goto fin; %end; /* Test sur l'existence de SAS-GRAPH */ %if %sysprod(GRAPH)=0 and %upcase(&graph)=O %then %do; %window ATTENTION color=grey icolumn=5 columns=100 rows=15 #4 @4 "ATTENTION ! Vous souhaitez utiliser SAS-GRAPH, alors que ce module" color=green "n'est pas disponible" color=green #7 @4 "Tapez sur Entrée pour continuer" color=green; %display ATTENTION; %let graph=n; %display GRAPH; %end; %goto fin2; %fin :; %let findial=o; %fin2 :; /* Stockage des valeurs des paramètres dans la table _paramplotafm_ */ data _paramplotafm_; plans=symget("plans"); iam=symget("iam"); ism=symget("ism"); ip=symget("ip"); fiam=symget("fiam"); fism=symget("fism"); typer=symget("typer"); id=symget("id"); graph=symget("graph"); typed=symget("typed"); van=symget("van"); vaq=symget("vaq"); vsn=symget("vsn"); vsq=symget("vsq"); cdgam=symget("cdgam"); cdgsm=symget("cdgsm"); cdgp=symget("cdgp"); fvan=symget("fvan"); fvaq=symget("fvaq"); fvsn=symget("fvsn"); fvsq=symget("fvsq"); fcdgam=symget("fcdgam"); fcdgsm=symget("fcdgsm"); typedcdg=symget("typedcdg"); gra=symget("gra"); grs=symget("grs"); data=symget("data"); proc transpose data=_paramplotafm_ out=_paramplotafm_(rename=(col1=vpar)) name=npar; var _character_; run; run; %mend fenplotafm; %global libref; %let fin=n; %let findial=n; %if %upcase(&fen)=O %then %do; %fenplotafm %end; %if &findial=o %then %goto fin; %let fin=o; %if %upcase(&fen) ne O %then %do; %testsplotafm %end; %if &fin=F %then %goto fin; %param; %nbplans; %if &iam=1 or &ism=1 %then %do; %indiv(points=individus); %plotindiv(points=individus); %end; %if &van=1 or &vaq=1 or &vsn=1 or &vsq=1 %then %do; %varia; %plotvaria; %end; %if &cdgam=1 or &cdgsm=1 %then %do; %centres; %end; %if &gra=1 or &grs=1 %then %do; %grou; %plotgrou; %end; %fin :; %mend plotafm;