Hi Everyone
I ran the folllowing code and it generated syntax error, which should be missing a symbol. However I have double check the code and I can not figure out which is missing? Please provide me some clues and any help will be much appreciated. Thanks
#############
The following is the code in editor.
DATA Shattering;
INFILE "C:\PHD\GWAS\Shattering.csv" DELIMITER="," FIRSTOBS=2;
INPUT PI $ code $ location $ shatearly shatlate;
proc glm data=Shattering method=REML covtest;
class code location;
model shatearly = code location;
lsmeans code;
proc glm data=Shattering method=REML covtest;
class code location;
model shatlate = code location;
lsmeans code;
run;
###################
The following is the error in log
127 proc glm data=Shattering method=REML covtest;
------
22
76
ERROR 22-322: Syntax error, expecting one of the following: ;, (, ALPHA, DATA, MANOVA,
MULTIPASS, NAMELEN, NOPRINT, ORDER, OUTSTAT, PLOTS.
ERROR 76-322: Syntax error, statement will be ignored.
128 class code location;
129 model shatearly = code location;
ERROR: No data set open to look up variables.
NOTE: The previous statement has been deleted.
Well, I can't really tell which of the GLM's this is refering too, why do you have two of the exact same code? Also note that it would be advisable to follow some sort of good programming practice, your code is unecessarily hard to read, for example:
data Shattering; infile "C:\PHD\GWAS\Shattering.csv" delimiter="," firstobs=2; input pi $ code $ location $ shatearly shatlate; run; proc glm data=shattering; class code location; model shatearly = code location; lsmeans code; quit; proc glm data=shattering; class code location; model shatlate = code location; lsmeans code; quit;
However, there is also some problem with your proc glm call, I find nowhere an option method=, which is why your getting this error.
https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#glm_toc.htm
Remove the extra options on the gl as above and the code works.
127 proc glm data=Shattering method=REML covtest;
------
22
76
ERROR 22-322: Syntax error, expecting one of the following: ;, (, ALPHA, DATA, MANOVA,
MULTIPASS, NAMELEN, NOPRINT, ORDER, OUTSTAT, PLOTS.
ERROR 76-322: Syntax error, statement will be ignored.
128 class code location;
129 model shatearly = code location;
ERROR: No data set open to look up variables.
NOTE: The previous statement has been deleted.
As stated in the log, covtest is not valid option statment for PROC GLM. PROC GLM Statement
Also method is not valid too.
method and covtest options are for proc mixed and proc glimmix. REML stands for Restricted maximum likelihood (a method for paramter estimates) and covtest for covariace test.
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 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.