@Rick_SAS Thank you! I will find the CALL EXECUTE very helpful in my work! Below is my code of how to do the proc mixed call. I don't know if you wanted all combinations (e.g. 1 -1 0 0 and -1 1 0 0) or just one (e.g. only -1 1 0 0). If you make it do j = i+1 to 4, then you will get only 1 combination. You can run this even if you don't have a dataset and see the code it writes for SAS to execute. data test; length Contrast $ 300; array a{4} a1 - a4; /* Initialize array */ do x = 1 to 4; a{x} = 0; end; Contrast = ''; /* This loop will cycle through the array. i controls the +1, j controls the -1. */ /* Contrast will have 12 unique contrasts for the model */ do i = 1 to 4; a{i} = 1; do j = 1 to 4; if i ^= j then do; a{j} = -1; do y = 1 to 4; Contrast = catx(' ',Contrast,a{y}); end; call execute ( "proc mixed data=data1 ; " || " class treatment genotype ;" || " model trait = treatment genotype treatment*genotype / htype=1 ddfm=satterth ;" || " lsmestimate treatment*genotype '(geno1-geno2)trt1 vs (geno1-geno2)trt2' " || Contrast || ";") ; output; Contrast = ''; a{j} = 0; end; end; a{i} = 0; end; keep Contrast; run;
... View more