I conducted a study for two years with two locations (fields) in the first year and two different locations (fields) in the second year for a total of 4 site-year combinations. At each location I have 4 blocks. Within each block is the whole plot of cover crop (3 factors) and a sublplot factor of N rate (3 factors). We took soil samples in each plot three times during the year.
My objective is to determine how different cover crop and N rate treatments affect various soil measurements and if that varies by sample timing and/or the site and year combinations. Below is the code I have so far. I am not sure if it is correct or not.
proc mixed data = CCSHCorn1 covtest plots = studentpanel ;
class block siteyear sampletiming covercrop nratecat ;
model activeC =siteyear|covercrop|nratecat|sampletiming /ddfm=kr2;
random block block(siteyear) covercrop*block(siteyear) ;
repeated sampletiming/subject=block(covercrop*nratecat)type=un;
lsmeans siteyear*covercrop*nratecat*sampletiming /diff adjust = Tukey;
ods output tests3=tests3
CovParms = RandomVar ;
ods exclude lsmeans;
ods exclude diffs;
ods output diffs=ppp lsmeans=mmm;
run;
The three groups are split by a specific trait, and all receive the same intervention. So yes, it is similar to three different classrooms of students that each receive the same teaching intervention.
Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.