/* it is important that you convert your treatments from a categorical system to a 
continuous system.  For example, here I have 3 watering treatments so instead of 
having trt = 1, 2, or 3, I have trt = watering frequencies from 0-1 */
proc mixed data = new covtest cl;
	class line; /* genotypes */
	where species = 'brav'; /* if you have different species, if not ignore this */
	model sqrttiller = trt /solution ddfm = sattert; /* your trait of interest = continuous treatment variables */
	random int trt / subject = line solution G Gcorr type = un; /* Calling for random intercepts and slopes for each genotype with an unstructure CV model */
	ods output solutionf=fixed solutionr=random; /* output your fixed effects and random effects (BLUPs) estimates */
	run;
data lines; /* creating a data set that will add the random deviations to the fixed effect estimates */
merge random(where=(Effect='Intercept') rename=(Estimate=rint))
random(where=(Effect='trt' ) rename=(Estimate=rslope));
if _n_ = 1 then merge
fixed(where=(Effect='Intercept') rename=(Estimate=fint))
fixed(where=(Effect='trt') rename=(Estimate=fslope));
intercept = fint + rint;
slope = fslope + rslope;
keep species line fint fslope rint rslope intercept slope;
run;
/* you will now have a data set called lines that has the adjusted estimates for slopes and intercepts of each genotype */

