%macro afd(dataset,ident,class,listev,m); %* Afd de dataset ; %* ident : variable contenant les identificateurs; %* des individus; %* listev : liste des variables (numeriques); %* class : variable contenant les classes; %* m : min(p,c-1) ou p est le nombre de variables et c le nombre de classes; %* options edition; options linesize=80 nodate pagesize=66 nonumber; title "A.f.d. des donnees de &dataset"; footnote; data donnees (keep=ident class &listev); set sasuser.&dataset ; ident=left(&ident); class=&class; run; proc candisc data=donnees simple bcorr tcorr out=compi outstat=teltpr; class class; var &listev; proc print data=compi noobs round; run; data tcompb (drop=_type_ _name_ ) tcorvf (drop=_type_ _name_ class); set teltpr; select (_type_); when ('BSTRUCT') output tcorvf; when ('CANMEAN') output tcompb; otherwise; end; run; proc transpose data=tcorvf out=corvf ; proc print noobs round; run; data compb ; set tcompb ; array l{*} _numeric_; array can{&m} ; ident='c'||left(class); retain can; if (mod(_N_,&m)=0) then do; can{&m}=l{1}; output; end; else can{mod(_N_,&m)}=l{1}; run; data coordi; set compi compb; run; %mend; %macro gafdix(x=1,y=2,nc=4); %* Graphique des individus; %* x : numero axe horizontal; %* y : numero axe vertical; %* nc : nombre max de caracteres; data anno; retain xsys ysys '2'; set coordi; style='swiss'; y= can&y; x= can&x; text=substr(left(ident),1,&nc); size=0.6; label y = "Axe &y" x = "Axe &x"; run; proc gplot data=anno; title; axis1 length=14cm; /* attention taille */ axis2 length=8cm; symbol1 v=dot height=0.4; plot y*x=class / annotate=anno frame href=0 vref=0 haxis=axis1 vaxis=axis2 ; run; goptions reset=all; quit; %mend; %macro gafdvx(x=1,y=2,nc=4); %* Graphique des variables avec cercle des correlations; %* x : numero axe horizontal; %* y : numero axe vertical; %* nc : nombre max de caracteres; data anno; retain xsys ysys '2'; set corvf nobs=p; y= col&y; x= col&x; style='swiss'; text=substr(_name_,1,&nc); size=0.8-max(0,3/10)+0.4*sqrt(x*x+y*y); label y = "Axe &y" x = "Axe &x"; output; function='pie'; x=0; y=0; style='E'; rotate=360; hsys='8';size=1; output; run; proc gplot data=anno; symbol1 v='none' i=join; title; footnote ; axis1 order = (-1 to 1 by 0.5) length=5CM; /* attention taille */ plot y*x=1 / annotate=anno haxis=axis1 vaxis=axis1; run; goptions reset=all; quit; %mend;