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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.