Hi.
Consider a 2-year trial to compare 17 treatments. The treatments were observed in randomized complete block design with 3 block was used. Both year and the block are random effects. Test in each year did in one different location
I use this analysis method:
title;
footnote;
*** Factorial ANOVA ***;
data=work.test2;
input year location treat rep Cycloxidim1 Arrat Cycloxidim2 OHC NLATOT WLATOT BY SY;
cards;
.
.
.
;
proc glm data=Work.Test2;
class year location treat rep;
model NLATOT WLATOT BY SY = year rep treat year*rep treat*year treat*rep /tolerance solution;
random year rep treat year*rep treat*year treat*rep / test;
contrast 'new herbicide vs Ordinal Herbicide' treat 0 -5 2 2 2 2 2 2 2 2 2 2 0 -5 -5 -5 0;
contrast 'ordinal herbicide vs control' treat -4 1 0 0 0 0 0 0 0 0 0 0 1 1 1 0;
contrast 'new herbicide vs control' treat -11 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0;
contrast 'new herbicide vs weeding' treat 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 -11;
contrast 'ordinal herbicide vs weeding' treat 0 1 0 0 0 0 0 0 0 0 0 0 1 1 1 -4;
contrast 'new herbicide high dosage vs new herbicide low dosage' treat 0 0 1 1 -1 -1 1 1 -1 -1 0 0 0 0 0 0 0;
contrast 'new herbicide one treat vs new herbicide two treat' treat 0 0 1 1 1 1 -1 -1 -1 -1 0 0 0 0 0 0 0;
contrast 'arrat low dosage vs arrat high dosage' treat 0 0 1 1 0 0 0 0 0 0 -1 -1 0 0 0 0 0;
estimate 'year' year -1 1;
estimate 'block' Rep -1 1;
estimate 'treatment' Treat -1 1;
estimate 'year*rep ' year*rep 1 -1 -1 1 / DIVISOR=2;
estimate 'year*treat ' year*treat 1 -1 -1 1 / DIVISOR=2;
estimate 'Rep*treat' Rep*treat 1 -1 -1 1 / DIVISOR=2;
means year rep treat year*rep treat*year treat*rep / hovtest=bartlett;
means year rep treat year*rep treat*year treat*rep / DUNCAN;
output out=diag P=pred R=resid;
lsmeans year rep treat year*rep treat*year treat*rep;
test h=year rep e= treat*year;
run;
PROC UNIVARIATE DATA=diag NORMAL ;
VAR resid;
run;
PROC RSREG DATA=Work.Test2 PLOTS=(DIAGNOSTICS RIDGE);
MODEL BY SY = year treat rep / LACKFIT VIF TOL XPX COVB;
RIDGE MAX MIN;
run;
PROC REG DATA=Work.Test2 outest=est1 outsscp=sscp1 rsquare;
Title'PP Plot'
MODEL BY SY = NLATOT WLATOT cycloxidim1/ noprint;
Plot npp. *r. / annotate=test2 nostat cframe=ligr
modellab="'Best'Two-Parameter Model:";
run;
Title'QQ Plot'
Plot r. *nqq. / noline mse cframe=ligr
modellab="'Best'Two-Parameter Model:";
run;
PROC Corr DATA=Work.Test2;
Var BY SY NLATOT WLATOT cycloxidim1;
run;
and I see these problem in log window:
NOTE: Starting the Analyst Application. .
.
. NOTE: TYPE I EMS not available without the E1 option. NOTE: year*rep is not estimable. NOTE: year*treat is not estimable. NOTE: Rep*treat is not estimable. NOTE: Means from the MEANS statement are not adjusted for other terms in the model. For adjusted means, use the LSMEANS statement. WARNING: Homogeneity of variance testing and Welch's ANOVA are only available for unweighted one-way models. NOTE: The data set WORK.DIAG has 102 observations and 127 variables. NOTE: PROCEDURE GLM used (Total process time): real time 4.23 seconds cpu time 1.12 seconds . .
35 PROC RSREG DATA=Work.Test2 PLOTS=(DIAGNOSTICS RIDGE); ----- 22 76 ERROR 22-322: Syntax error, expecting one of the following: ;, (, DATA, DEBUG, EPSILON, NOPRINT, OUT. ERROR 76-322: Syntax error, statement will be ignored. 36 MODEL BY SY = year treat rep / LACKFIT VIF TOL XPX COVB; --- 22 76 ERROR: No data set open to look up variables. ERROR: No data set open to look up variables. ERROR: No data set open to look up variables. ERROR: No data set open to look up variables. ERROR: No data set open to look up variables. ERROR 22-322: Syntax error, expecting one of the following: ;, /, ACTUAL, BYOUT, COOKD, COVAR, D, DUMMY, L95, L95M, LACKFIT, NOANOVA, NOAOV, NOCODE, NOOPT, NOOPTIMAL, NOPRINT, PREDICT, PRESS, RESIDUAL, U95, U95M. ERROR 76-322: Syntax error, statement will be ignored. 37 RIDGE MAX MIN; 38 run; NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE RSREG used (Total process time): real time 0.06 seconds cpu time 0.04 seconds 39 PROC REG DATA=Work.Test2 outest=est1 outsscp=sscp1 rsquare; 40 Title'PP Plot' 41 MODEL BY SY = NLATOT WLATOT cycloxidim1/ noprint; WARNING: The TITLE statement is ambiguous due to invalid options or unquoted text. 42 Plot npp. *r. / annotate=test2 nostat cframe=ligr 43 modellab="'Best'Two-Parameter Model:"; 44 run; WARNING: No variables specified for an SSCP matrix. Execution terminating. NOTE: PROCEDURE REG used (Total process time): real time 0.14 seconds cpu time 0.14 seconds NOTE: The data set WORK.EST1 has 0 observations and 8 variables. NOTE: The data set WORK.SSCP1 has 0 observations and 3 variables. 45 Title'QQ Plot' 46 Plot r. *nqq. / noline mse cframe=ligr WARNING: The TITLE statement is ambiguous due to invalid options or unquoted text. 47 modellab="'Best'Two-Parameter Model:"; 48 run; 49 PROC Corr DATA=Work.Test2; 50 Var BY SY NLATOT WLATOT cycloxidim1; 51 run; NOTE: PROCEDURE CORR used (Total process time): real time 0.14 seconds cpu time 0.07 seconds
Please help me to Know my fault in writing sas codes.
2. Also I want to find linear, quardratic and cubic relationship between BY and SY with NLATOT WLATOT Cycloxidim1 for Treatment 3 to 10.
thanks.
35 PROC RSREG DATA=Work.Test2 PLOTS=(DIAGNOSTICS RIDGE); ----- 22 76 ERROR 22-322: Syntax error, expecting one of the following: ;, (, DATA, DEBUG, EPSILON, NOPRINT, OUT. ERROR 76-322: Syntax error, statement will be ignored. 36 MODEL BY SY = year treat rep / LACKFIT VIF TOL XPX COVB; --- 22 76 ERROR: No data set open to look up variables. ERROR: No data set open to look up variables. ERROR: No data set open to look up variables. ERROR: No data set open to look up variables. ERROR: No data set open to look up variables. ERROR 22-322: Syntax error, expecting one of the following: ;, /, ACTUAL, BYOUT, COOKD, COVAR, D, DUMMY, L95, L95M, LACKFIT, NOANOVA, NOAOV, NOCODE, NOOPT, NOOPTIMAL, NOPRINT, PREDICT, PRESS, RESIDUAL, U95, U95M. ERROR 76-322: Syntax error, statement will be ignored.
As stated in the log VIF,TOL,XPX, COVB are not valid PROC RSREG Model statments options. MODEL Statement
Also you forget the semicolon after the title statments as in the nest log Warning.
39 PROC REG DATA=Work.Test2 outest=est1 outsscp=sscp1 rsquare; 40 Title'PP Plot' 41 MODEL BY SY = NLATOT WLATOT cycloxidim1/ noprint; WARNING: The TITLE statement is ambiguous due to invalid options or unquoted text.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.