Você está na página 1de 19

SAS FOR STATISTICAL GENETICS

Amrit Kumar Paul


I.A.S.R.I., Library Avenue, Pusa, New Delhi 110 012
pal@iasri.res.in

1. Heritability
We know that the observed variance or phenotypic variance (VP) is composed partly of
genetic or heritable (VG) and partly of non-heritable variation (VE). The genetic variation
itself can be sub-divided into (i) the additive genetic variation (VA) (ii) the dominance
genetic variation due to deviation of the heterozygote from the average of the two
homozygotes (VD) and (iii) the epistatic variation due to interaction among non-allelic
genes (VI).
i.e. VP VG VE
VP VA + V D VI + VE

The ratio of the total genetic variation to the total phenotypic or observed variation is
termed as co-efficient of heritability in broad sense where as the ratio of the additive
genetic variation to the total observed variation is called the co-efficient of heritability in
the narrow sense.
i.e. h (2b) Heritability in broad sense
VG

VP
and h (2n ) Heritability in narrow sense
VA

VP
2 2
In general h (n ) is represented by the symbol h which in turn is also defined as the square
of the path co-efficient (h) between heredity and phenotype. The path coefficient is in
fact a correlation between breeding value and phenotypic value (VAP). Another
equivalent meaning of the heritability is the regression of breeding value on phenotypic
value (bAP). Because of this very definition, the role of heritability is very prominent in
predicting the breeding value of an individual as well as in predicting the genetic
improvement expected as a result of the adoption of a particular scheme of selection.

2. Genetic Correlation
The phenotypic correlation between two characters can be influenced by inheritance,
environmental or both. When the correlation is mainly genetic, consideration must be
taken of this in the breeding plans. Now let us see that how this phenotypic correlation is
related to genetic correlation, which is the correlation of breeding values and the
environmental correlation which is not strictly speaking the correlation of environmental
deviations but the correlation of environmental deviations together with non-additive
genetic deviation. In other words just as the partitioning of the variance of character is
done into the two components, additive genetic versus all the rest, so now the covariance
SAS for Statistical Genetics

of the two characters can also be partitioned into these two components. The genetic
and environmental correlations thus correspond to the partitioning of the covariance
into the additive genetic component versus all the rest.

A correlation between character X and Y, whatever its nature is the ratio of the
appropriate covariance to the product of the two standard deviation. For example the
phenotypic correlation is
COVP
rP
V PX V PY

The phenotypic covariance is the sum of the genetic and environmental covariances, so
we can write the phenotypic correlation as
COV A COV E
rP
V PX V PY
The denominator can be differently expressed by the following device VA h2VP and
VE e2VP so the phenotypic correlation then becomes.
COV A COV E
rP hxhy ex ey
V AX V AY V EX V EY

Therefore rP hxhy rA ex ey rE
rA = COV A .
V AX V A Y

3. Repeatability
When more than one measurement of the character can be made on each individual, the
phenotypic variance can be partitioned into variance between individuals and variance
within individuals. The component within individuals measures the differences between
the performances of the same individual and a component between individuals measures
the permanent differences between individuals.

The former component is entirely environmental but the latter component is partly
environmental and partly genetic. The within-individual environmental component is
caused by temporary differences of environmental between successive performances but
the corresponding between-individual environmental component is due to circumstances
affecting the individual permanently. Thus the component VE is divided into VES, the
special environmental variance, the within-individual component due to temporary or
localised circumstances and by VEST,, the general environmental variance, the between-
individual environmental component due to permanent or non-localised circumstances.
The ratio of the between-individual component to the total phenotypic variance measures
the repeatability (R) of the character i.e.
V VEG
R G
VP
When VG and VP are genetic and phenotypic variances respectively.
SAS for Statistical Genetics

Program for heritability and genetic correlation.


data halfsib;
input sire a b;
ab=a+b;
cards;
1 175 54
1 170 66
1 23 45
.
.
;
run;
/*Calculation of Variance Component*/
ods output estimates=estimates_parm;
ods listing close;

proc varcomp data=halfsib method=type1 maxiter=5000 epsilon=10E-12 ;


class sire;
model a b ab=sire;
run;
ods listing;

data test; set estimates_parm;


newvar=dependent||varcomp;drop dependent varcomp;
run;

/*proc sort data=test (); by newvar;run;*/

proc transpose data=estimates_parm out=estimates_tparm (drop=_name_);


/* id VarComp;*/
/*by dependent;*/
run;
/*Calculation of Heritability and Genetic Correlation*/

data halfsib; set estimates_tparm;


rename col1 = sire_a
col2 = Error_a
col3 = sire_b
col4 = Error_b
col5 = sire_ab
col6 = Error_ab;
run;
SAS for Statistical Genetics

data halfsib ; set halfsib ;


herit_a=4*sire_a/(sire_a + error_a);
herit_b=4*sire_b/(sire_b + error_b);
sire_cov_ab=0.5*(sire_ab - sire_a - sire_b);
gcorr_ab=sire_cov_ab/sqrt(sire_a*sire_b);
label sire_a = 'Sire component Variance of a'
sire_b = 'Sire component Variance of b'
sire_ab = 'Sire component Variance of a+b'
sire_cov_ab = 'Sire component covariance of a and b'
gcorr_ab = 'Genetic Correlation between a and b'
herit_a = 'Heritability of a'
herit_b = 'Heritability of b';
run;

proc print; run;


Program for heritability incase of halfsib
proc iml;
vs=0.225; ve=0.775;
print vs ve;
ht=4*vs/(vs+ve);
print ht;
p=200;
m=12;
do iter=1 to p;
do i=1 to 50;
si=sqrt(vs)*rannor(3567897);
do k=1 to 4;
eijk=sqrt(ve)*rannor(0);
z=m+si+eijk;
yd=yd//z;sr1=sr1//i;num=num//iter;gm=gm//1;
end;
end;
end;
create no_select var{yd sr1 num gm};
append ;
run; quit iml;
data pop1;
set no_select;
proc mixed method=type3 noclprint noinfo noitprint;
class sr1;
model yd=gm;
random sr1;
make 'covparms' out=canv;
by num notsorted;
run;
SAS for Statistical Genetics

data pop2;
set no_select;

proc mixed method=ml noclprint noinfo noitprint;


class sr1;
model yd=gm;
random sr1;
make 'covparms' out=cml;
by num notsorted;
run;
data pop3;
set no_select;
proc mixed method=reml noclprint noinfo noitprint noprofile ;
class sr1;
model yd=gm;
random sr1;
make 'covparms' out=creml;
by num notsorted;
run;
data pop4;
set no_select;
proc mixed method=mivque0 noclprint noinfo noitprint noprofile ;
class sr1;
model yd=gm;
random sr1;
make 'covparms' out=cmivque;
by num notsorted;
run;

proc iml;
use canv;
read all into anvc;
p=200;v={0.225 0.775};ht=4*v[1,1]/v[,+];
anvc=anvc[,2];
anvc=shape(anvc,p);
anvcmn=anvc[+,]/p;
anvcbias=anvcmn-v;
anht=4*anvc[,1]/anvc[,+];
anhtbias=anht-ht;
anhtbiasmn=anhtbias[+,]/p;
anhtmn=anht[+,]/p;
anhtbs=anhtmn-ht;
anhtmse=ssq(anht-ht)/p;
SAS for Statistical Genetics

**print anvcmn anhtmn anhtbs anhtmse;


use cml;
read all into mlvc;
mlvc=mlvc[,2];
mlvc=shape(mlvc,p);
mlvcmn=mlvc[+,]/p;
mlvcbias=mlvcmn-v;
mlht=4*mlvc[,1]/mlvc[,+];
mlhtbias=mlht-ht;
mlhtbiasmn=mlhtbias[+,]/p;
mlhtmn=mlht[+,]/p;
mlhtbs=mlhtmn-ht;
mlhtmse=ssq(mlht-ht)/p;

**print mlvcmn mlhtmn mlhtbs mlhtmse;


use creml;
read all into remlvc;
remlvc=remlvc[,2];
remlvc=shape(remlvc,p);
remlvcmn=remlvc[+,]/p;
remlvcbs=remlvcmn-v;
remlht=4*remlvc[,1]/remlvc[,+];
remlhtbias=remlht-ht;
remlhtbiasmn=remlhtbias[+,]/p;
remlhtmn=remlht[+,]/p;
remlhtbs=remlhtmn-ht;
rmlhtmse=ssq(remlht-ht)/p;

**print remlvcmn remlhtmn remlhtbs rmlhtmse;


use cmivque;
read all into mivqvc;
mivqvc=mivqvc[,2];
mivqvc=shape(mivqvc,p);
mqvcmn=mivqvc[+,]/p;
mqvcbias=mqvcmn-v;
mivqht=4*mivqvc[,1]/mivqvc[,+];
mivqhtbias=mivqht-ht;
mivqhtbiasmn=mivqhtbias[+,]/p;
mivqhtmn=mivqht[+,]/p;
mivqhtbs=mivqhtmn-ht;
mvqhtmse=ssq(mivqht-ht)/p;

**print mqvcmn mivqhtmn mivqhtbs mvqhtmse;


vc=anvcmn//mlvcmn//remlvcmn//mqvcmn;
ht=anhtmn//mlhtmn//remlhtmn//mivqhtmn;
htbs=anhtbs//mlhtbs//remlhtbs//mivqhtbs;
SAS for Statistical Genetics

mse=anhtmse//mlhtmse//rmlhtmse//mvqhtmse;
print vc ht htbs mse;
run;

Program for genetic correlation


data A;
input Obs location $ rep family $ tree y trait ;
datalines ;
1 AL 1 F1 1 128 1
2 AL 1 F1 2 107 1
.
.
;
proc mixed data=A covtest asycov ;
Class trait location rep family tree;
model y =trait location rep(location) ;
random trait /type=un sub=family g gcorr;
repeated /type=UN sub=family*location*tree r rcorr;
ods output covparms=_varcomp asycov=_cov ;
run;
cov={11 12 13
12 22 23
13 23 33 };

/* You do NOT need to change the following lines, except, If the name of the genotype in
your data is not 'family' then change it accordingly */
/* Start IML */

proc iml ;
/* Go to output file '_varcomp', and create a 3-row vector for 'family' group only. The 1st
estimate (row) is genetic variance of Trait1, the 2nd is the genetic Covariance, and the
3rd is genetic variance of Trait2 */
use _varcomp;
read all var {Estimate} where(Subject="family") into _varcomp;
close _varcomp;
/* Create Asymptotic Covariance Matrix for 'family' group, select the first 3x3 block
matrix of variances of estimates and covariances between estimates */
use _cov;
read all var {CovP1 CovP2 CovP3} into _cov;
close _cov;
/* Genetic correlation */
r = _varcomp[2,1]/sqrt(_varcomp[1,1]*_varcomp[3,1]);
/* Standard error of genetic correlation */
SAS for Statistical Genetics

/*

*/
a =_cov[1,1]/(4*(_varcomp[1,1])**2) ;
ab=_cov[2,2]/((_varcomp[2,1])**2) ;
b =_cov[3,3]/(4*(_varcomp[3,1])**2) ;
c1=(2*_cov[1,3])/ (4*(_varcomp[1,1]*_varcomp[3,1]));
c2=(2*_cov[1,2])/ (2*(_varcomp[1,1]*_varcomp[2,1]));
c3=(2*_cov[2,3])/ (2*(_varcomp[2,1]*_varcomp[3,1]));
var_r=(r*r)*(a+b+ab+c1-c2-c3); ** Variance of genetic correlation ;
SE_r =sqrt(var_r) ; ** Standard error of genetic correlation ;
print r var_r SE_r ;
run; quit;

Estimate of heritability using BLUP


proc iml;
start imlsort(inmat,key);
res1 =inmat; res2 = res1;
ar = res1[,key];
res1[rank(ar),]=res2;
res3 = res1;
return (res3);
finish;
vs=0.125; ve=1;
print vs ve;
ht=4*vs/(vs+ve);
print ht;
x=0;
do i=1 to 10;
si=sqrt(vs)*rannor(i*3567897);
do j=1 to 20;
eij=sqrt(ve)*rannor(j*1379371);
x=x+1;
z=si+eij;
yld=yld//z;
sire=sire//i;
end;
end;
no_select=yld||sire;
print no_select;
create pop1 var{yld sire};
append from no_select;
phen_select=imlsort(no_select,1);
SAS for Statistical Genetics

print x;
y=x*95/100;
phen_select=phen_select[1:y,1:2];
print phen_select;
create pop2 var{yld sire};
append from phen_select;
quit iml;

proc surveyselect data=pop1 method=srs n=15 out=pop3;


run;

proc print data=pop3;


run;

proc mixed data=pop1;


class sire;
model yld=;
random sire;
estimate 'sire1 BLUP' intercept 1 | sire 1 0 0 0 0 0 0 0 0 0;

estimate 'sire2 BLUP' intercept 1 | sire 0 1 0 0 0 0 0 0 0 0;

estimate 'sire3 BLUP' intercept 1 | sire 0 0 1 0 0 0 0 0 0 0;

estimate 'sire4 BLUP' intercept 1 | sire 0 0 0 1 0 0 0 0 0 0;

estimate 'sire5 BLUP' intercept 1 | sire 0 0 0 0 1 0 0 0 0 0;

estimate 'sire6 BLUP' intercept 1 | sire 0 0 0 0 0 1 0 0 0 0;

estimate 'sire7 BLUP' intercept 1 | sire 0 0 0 0 0 0 1 0 0 0;

estimate 'sire8 BLUP' intercept 1 | sire 0 0 0 0 0 0 0 1 0 0;

estimate 'sire9 BLUP' intercept 1 | sire 0 0 0 0 0 0 0 0 1 0;

estimate 'sire10 BLUP' intercept 1 | sire 0 0 0 0 0 0 0 0 0 1;


run;
proc varcomp data=pop1 method=mivque0;
class sire;
model yld=sire;
run;

proc varcomp data=pop1 method=ml;


class sire;
model yld=sire;
SAS for Statistical Genetics

run;

proc varcomp data=pop1 method=reml;


class sire;
model yld=sire;
run;
proc varcomp data=pop2 method=mivque0;
class sire;
model yld=sire;
run;

proc varcomp data=pop2 method=ml;


class sire;
model yld=sire;
run;

proc varcomp data=pop2 method=reml;


class sire;
model yld=sire;
run;

proc varcomp data=pop3 method=mivque0;


class sire;
model yld=sire;
run;

proc varcomp data=pop3 method=ml;


class sire;
model yld=sire;
run;

proc varcomp data=pop3 method=reml;


class sire;
model yld=sire;
run;

Genotype and environment Interaction:


To identify genotypes which possess the dual qualities of
a) high-yield sustainability and
b) low sensitivity to adverse changes in environmental condition.

One of the important steps here is to assess the performance of improved genotypes in
multi-environment (multi-location, multi-year or both) trials.

Quite often it is observed that varieties perform differently in different environments. A


specified difference in environment may produce differential (different) effect on
SAS for Statistical Genetics

genotype. This interplay of genetic and non-genetic effects causing differential relative
performances of genotypes in different environments is called Genotype x Environment
Interaction (GEI).

Presence of GEI causes difficulty in identifying superior genotypes. Not withstanding its
importance GEI is often a distraction in genetical analysis for which effort is usually
made to overcome such interactions.

One way of reducing GEI is through resistant breeding, usually adopted by plant
breeders. Since only a minor part of the GEI can be attributed to controllable
environmental determinants, much reduction in interaction can not be achieved. The
most practical alternative is to produce progressively better adapted populations to the
existing environments.

1) program for G E Interaction


options ls=77 ps=1000 nodate;

data A;
input E R G X;
cards;
1 1 1 36.4
1 2 1 41.3
1 3 1 51.7
.
.
;

proc glm data=ge2;


class E R G;
model X = E R(E) G E*G/ss3;
random E R(E) G E*G/test;
means G;
title 'GLM analysis of GXEDS3 simulated data';

/********************************************************************/
/* The following three steps are designed to calculate genotype */
/* means for each environment (experiment) as well as overall */
/* environment means. */
/* */
/* A) Calculate genotype (within environment) means as fitted */
/* values for analysis with G, E and G*E effects */
/* These fitted values are labelled GXE */
/* B) Calculate environment means as fitted values for analysis */
/* with only E effects */
/* These fitted values are labelled EINDEX */
/* C) Extract means by keeping only the first replicate */
SAS for Statistical Genetics

/********************************************************************/
proc glm;
class E G;
model X = E G E*G;
output out = a p = gxe;

proc glm;
class E;
model X = E;
output out = b p = eindex;
data c;
set b;
if R > 1 then delete;

/* Sort the new dataset by genotype and print it for verification */

proc sort data=c;


by G;

proc print data=c;


/* Now carry out individual regressions of genotype performance */
/* (within environment), GXE, on environmental index EINDEX */

proc reg data=c;


by G;
model GXE = EINDEX;
title 'Individual regressions of GXE on index';
2) SAS program for Eberhert-Russel stability measure:

options nodate ls=75;


data stability; set sasuser.stability;
if gen=. then delete;run;
proc means data=stability noprint mean;
var yield;
output out=yppp mean=yppp;
proc sort data=stability; by env;
proc means noprint mean; by env;
var yield;
output out=yipp mean=yipp;
proc sort data=stability; by gen env;
proc means noprint mean; by gen env;
var yield;
output out=ypjp mean=ypjp;
proc sort data=yppp; by _TYPE_;
proc sort data=yipp; by _TYPE_;
data enveff;
SAS for Statistical Genetics

merge yipp yppp(drop=_freq_);


by _TYPE_;
ei=yipp-yppp;
proc sort data=enveff; by env;
proc sort data=ypjp; by env;

data pool; merge enveff ypjp (drop=_freq_);


by env;run;
data pool1; set pool;
dep=ypjp-yppp;run;
proc sort data=pool1; by gen;run;
proc reg data=pool1 outest=pal;
by gen;
model dep=ei/noint;run;
data pal;
set pal;
betai=ei;
keep gen betai;

proc print data=pal;run;

3) Program simultaneous stability and yield

data GE1;
proc import datafile='c:\data3.xls' out=GE2;

proc iml;
use GE2;
var=10;loc=4;
read all var{yld} into yld;
y=shape(yld,loc,var);
y=y`;
print y;
yi=y[,+]/loc;
yj=y[+,]/var;
ymean=yi[+,]/var;
x=repeat(1,var,loc);
do i=1 to var; do j=1 to loc;
x[i,j]=(y[i,j]-yi[i]-yj[j]+ymean);
end;
end;
f3=rank(1/yi);
xpx=x*x`;
a=eigval(xpx);
b=eigvec(xpx);
a1=a[+,];
SAS for Statistical Genetics

a2=a/a1;
a3=0;cnt=0;
do i=1 to var;
a3=a3+a2[i];
if a3<0.9 then cnt= cnt+1;
end;
cnt=cnt+1;
d=repeat(1,var,var);
do i=1 to cnt;
d[,i]=a[i]*b[,i];
end;
do i=1 to var;
e=1/sqrt((ssq(d[i,])));
f=f//e;
end;
e3=(1/f);
f4=rank(e3);
e1=f[+,]/var;
do i=1 to var;
e2=(yi[i]/ymean)+0.25*(f[i]/e1);/* value of w can be given as per requirement. For
I1,w=1.0;forI2,w=0.66; forI3,w=0.43 and for I4,w=0.25 */
f1=f1//e2;
end;
index=f1;
f2=rank(1/f1);
index_rank=f2;
stability=e3;
stab_rank=f4;
yield=yi;
yld_rank=f3;
do l=1 to var;
variety_number=variety_number//l;
end;
print variety_number index index_rank yield yld_rank
stability stab_rank;
run;

4) AMMI Biplot
/*Libname ammi 'D:\Stability Analysis (Director)';*/
OPTIONS PS = 5000 LS=78 NODATE;
FILENAME BIPLOT 'Yield.cgm';
GOPTIONS DEVICE=CGMMWWC GSFNAME=BIPLOT GSFMODE=REPLACE;

DATA RAW;
INPUT ENV $ REP GEN $ YLD;
CARDS;
SAS for Statistical Genetics

1 1 2 1.9254924
1 1 3 1.3330332
1 1 4 1.83662352
1 1 5 2.63644344
1 1 6 2.1476646
.
.
;

PROC GLM DATA=RAW OUTSTAT=STATS;


CLASS REP ENV GEN;
MODEL YLD = REP ENV GEN ENV*GEN/SS4;

DATA STATS2;
SET STATS;
IF _SOURCE_ = 'ERROR';
SSE=SS;
DFE=DF;
MSE=SSE/DFE;
KEEP DFE MSE;
DATA STATS3;
SET STATS;
IF _SOURCE_ = 'REP';
NREP=DF+1;

PROC SORT DATA=RAW;


BY ENV GEN;

PROC MEANS DATA = RAW NOPRINT;


BY ENV GEN;
VAR YLD;
OUTPUT OUT = MEDIAS MEAN=YLDM;

PROC GLM DATA=MEDIAS NOPRINT;


CLASS ENV GEN;
MODEL YLDM = ENV GEN / SS4 ;
OUTPUT OUT=OUTRES R=RESID;
DATA OUTRES;
SET OUTRES;

PROC SORT DATA=OUTRES;


BY GEN ENV;

PROC TRANSPOSE DATA=OUTRES OUT=OUTRES2;


SAS for Statistical Genetics

BY GEN;
ID ENV;
VAR RESID;

PROC IML;
USE OUTRES2;
READ ALL INTO RESID;
NGEN=NROW(RESID);
NENV=NCOL(RESID);

USE STATS2;
READ VAR {MSE} INTO MSEM;
READ VAR {DFE} INTO DFEM;

USE STATS3;
READ VAR {NREP} INTO NREP;

CALL SVD (U,L,V,RESID);


MINIMO=MIN(NGEN,NENV);
L=L[1:MINIMO,];

SS=(L##2)*NREP;
SUMA=SUM(SS);
PORCENT=((1/SUMA)#SS)*100;
MINIMO=MIN(NGEN,NENV);
PORCENTA=0;
DO I = 1 TO MINIMO;
DF=(NGEN-1)+(NENV-1)-(2*I-1);
DFA=DFA//DF;
PORCEACU=PORCENT[I,];
PORCENTA=PORCENTA+PORCEACU;
PORCENAC=PORCENAC//PORCENTA;
END;

DFE=J(MINIMO,1,DFEM);
MSE=J(MINIMO,1,MSEM);
SSDF=SS||PORCENT||PORCENAC||DFA||DFE||MSE;

L12=L##0.5;

SCOREG1=U[,1]#L12[1,];
SCOREG2=U[,2]#L12[2,];
SCOREG3=U[,3]#L12[3,];
SCOREE1=V[,1]#L12[1,];
SCOREE2=V[,2]#L12[2,];
SCOREE3=V[,3]#L12[3,];
SAS for Statistical Genetics

SCOREG=SCOREG1||SCOREG2||SCOREG3;
SCOREE=SCOREE1||SCOREE2||SCOREE3;
SCORES=SCOREG//SCOREE;

CREATE SUMAS FROM SSDF;


APPEND FROM SSDF;
CLOSE SUMAS;

CREATE SCORES FROM SCORES;


APPEND FROM SCORES ;
CLOSE SCORES;

DATA SSAMMI;
SET SUMAS;
SSAMMI =COL1;
PORCENT =COL2;
PORCENAC=COL3;
DFAMMI =COL4;
DFE =COL5;
MSE =COL6;
DROP COL1 - COL6;
MSAMMI=SSAMMI/DFAMMI;
F_AMMI=MSAMMI/MSE;
PROBF=1-PROBF(F_AMMI,DFAMMI,DFE);

PROC PRINT DATA=SSAMMI NOOBS;


VAR SSAMMI PORCENT PORCENAC DFAMMI MSAMMI F_AMMI PROBF;

PROC SORT DATA=RAW;


BY GEN;
PROC MEANS DATA = RAW NOPRINT;
BY GEN ;
VAR YLD;
OUTPUT OUT = MEDIAG MEAN=YLD;
DATA NAMEG;
SET MEDIAG;
TYPE = 'GEN';
NAME = GEN;
KEEP TYPE NAME YLD;

PROC SORT DATA=RAW;


BY ENV;
PROC MEANS DATA = RAW NOPRINT;
BY ENV ;
VAR YLD;
SAS for Statistical Genetics

OUTPUT OUT = MEDIAE MEAN=YLD;


DATA NAMEE;
SET MEDIAE;
TYPE = 'ENV';
NAME1 = 'S'||ENV;
NAME = COMPRESS(NAME1);
KEEP TYPE NAME YLD;

DATA NAMETYPE;
SET NAMEG NAMEE;

DATA BIPLOT ;
MERGE NAMETYPE SCORES;
DIM1=COL1;
DIM2=COL2;
DIM3=COL3;
DROP COL1-COL3;

PROC PRINT DATA=BIPLOT NOOBS;


VAR TYPE NAME YLD DIM1 DIM2 DIM3;

Data labels;
set biplot;
retain xsys '2' ysys '2' ;
length function text $8 ;
text = name ;

if type = 'GEN' then do;


color='black ';
size = 0.6;
style = 'hwcgm001';
x = dim1;
y = dim2;
if dim1 >=0
then position='5';
else position='5';
function = 'LABEL';
output;
end;

if type = 'ENV' then DO;


color='black ';
size = 0.6;
style = 'hwcgm001';
x = 0.0;
y = 0.0;
SAS for Statistical Genetics

function='MOVE';
output;
x = dim1;
y = dim2;
function='DRAW' ;
output;
if dim1 >=0
then position='5';
else position='5';
function='LABEL';
output;
end;

Proc gplot data=biplot;

Plot dim2*dim1 / Annotate=labels frame


Vref=0.0 Href = 0.0
cvref=black chref=black
lvref=3 lhref=3
vaxis=axis2 haxis=axis1
vminor=1 hminor=1 nolegend;

symbol1 v=none c=black h=0.7 ;


symbol2 v=none c=black h=0.7 ;

axis2
length = 6.0 in
order = (-1.0 to 1.0 by 0.2)
label=(f=hwcgm001 h=1.2 a=90 r=0 'Factor 2')
value=(h=0.8)
minor=none;

axis1
length = 6.0 in
order = (-1.0 to 1.0 by 0.2)
label=(f=hwcgm001 h=1.2 'Factor 1')
value=(h=0.8)
minor=none;

Title f=hwcgm001 h=1.0 'AMMI Biplot for Yield';


run;

Você também pode gostar