BookmarkSubscribeRSS Feed
grace
Calcite | Level 5

 

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.

3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

mohamed_zaki
Barite | Level 11

 

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.

SAS_inquisitive
Lapis Lazuli | Level 10

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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 5092 views
  • 0 likes
  • 4 in conversation