DATA Step, Macro, Functions and more

ERROR 22-322: Syntax error, expecting one of the following:

Reply
New User
Posts: 1

ERROR 22-322: Syntax error, expecting one of the following:

 

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.

Super User
Super User
Posts: 7,401

Re: ERROR 22-322: Syntax error, expecting one of the following:

[ Edited ]

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.

Super Contributor
Posts: 490

Re: ERROR 22-322: Syntax error, expecting one of the following:

[ Edited ]

 

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.

Regular Contributor
Posts: 234

Re: ERROR 22-322: Syntax error, expecting one of the following:

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.

Ask a Question
Discussion stats
  • 3 replies
  • 2040 views
  • 0 likes
  • 4 in conversation