## Example 3 for PROC HPMIXED

```/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: HPMEX3                                              */
/*   TITLE: Example 3 for PROC HPMIXED                          */
/*          Using PROC GLIMMIX for Further Analysis             */
/* PRODUCT: STAT                                                */
/*  SYSTEM: ALL                                                 */
/*    KEYS: Large problem, Glimmix procedure                    */
/*   PROCS: HPMIXED, GLIMMIX                                    */
/*    DATA:                                                     */
/*                                                              */
/* SUPPORT: Tianlin Wang                                        */
/*     REF: PROC HPMIXED, EXAMPLE 3.                            */
/*    MISC:                                                     */
/****************************************************************/
data Sim;
keep Species Farm Animal Yield;
array AnimalEffect{3000};
array AnimalSpecies{3000};
array AnimalFarm{3000};
do i = 1 to 3000;
AnimalEffect{i} = sqrt(4.0)*rannor(12345);
AnimalSpecies{i} = 1 + int(5*ranuni(12345));
AnimalFarm{i}    = 1 + int(10*ranuni(12345));
end;
do i = 1 to 40000;
Animal  = 1 + int(3000*ranuni(12345));
Species = AnimalSpecies{Animal};
Farm    = AnimalFarm{Animal};
Yield   = 1 + Species + int(Farm/2) + AnimalEffect{Animal}
+ sqrt(8.0)*rannor(12345);
output;
end;
run;
proc hpmixed data=Sim;
class Species Farm Animal;
model Yield = Farm|Species;
random Animal;
test Species Species*Farm;
ods output CovParms=HPMEstimate;
run;
ods graphics on;
proc glimmix data=Sim;
class Species Farm Animal;
model Yield = Farm|Species;
random int/sub=Animal;
parms /pdata=HPMEstimate hold=1,2 noiter;
lsmeans Farm / pdiff=all plot=diffplot;
run;

```