BookmarkSubscribeRSS Feed
lcmiles2
Calcite | Level 5

I am VERY new at using SAS. I am working through a Lab for school and am running into some errors even though I am copying the code exactly. Its seems that the problem is always the contrast or estimate phrase although I am unsure what is wrong with it. All of the three examples below give me the same two codes- 22-322 and 76-322 directly below the contrast or estimate statement. What have I done wrong..?

 

proc glm data = clover;

class strain; model nitrogen = strain / solution;

estimate ’avg. of K1-K5 vs. composite’ strain -1 0.2 0.2 0.2 0.2 0.2 / e;

run;

 

OR

 

proc glm data = clover;

class strain; model nitrogen = strain / clparm;

estimate ’avg. of K1-K5 vs. composite’ strain -1 0.2 0.2 0.2 0.2 0.2 / e;

run;

 

OR

class strain;

model nitrogen = strain;

contrast ’diff among K1 - K5’ strain 0 1 -1 0 0 0,

                                              strain 0 0 1 -1 0 0,

                                              strain 0 0 0 1 -1 0,

                                              strain 0 0 0 0 1 -1 / e;

run;

5 REPLIES 5
ballardw
Super User

Whenever you have a question about an Error, Warning or Note message it is best practice to copy the text from the LOG the entire data step or Procedure that generates the message along with all the messages. Then on the forum open a text box using the </> icon an paste the copied text.

The text box is important because many of the SAS error messages include diagnostic characters and if you paste the text into the main message window the text is reformatted and the diagnostic messages lose alignment. The 22-322 and 76-322  are two that usually place an _ character, or string of them, under the specific item that the SAS syntax checker indicates is the problem.

Another reason to include the LOG text is amazingly enough many people post code that was not actually what they ran. Sometimes referencing different data sets, sometime just missing ; at end of statements. 

 

We don't have your data so cannot actually run your model. You might have issues with the number of levels of your Strain variable.

 

Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the </> icon or attached as text to show exactly what you have and that we can test code against.

lcmiles2
Calcite | Level 5
1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 68         
 69         proc glm data = clover;
 70         class strain;
 71         model nitrogen = strain;
 72         contrast ’diff among K1 - K5’ strain 0 1 -1 0 0 0,
                     _______
                     22
                     76
 ERROR 22-322: Expecting a quoted string.  
 ERROR 76-322: Syntax error, statement will be ignored.
 73         strain 0 0 1 -1 0 0,
 74         strain 0 0 0 1 -1 0,
 75         strain 0 0 0 0 1 -1 / e;
 NOTE: The previous statement has been deleted.
 76         run;
 
 77         
 78         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 88         
 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 68         
 69         proc glm data = clover;
 70         class strain;
 71         model nitrogen = strain / solution;
 72         estimate ’avg. of K1-K5 vs. co’ strain -1 0.2 0.2 0.2 0.2 0.2 / e;
                     _______
                     22
                     76
 NOTE: The previous statement has been deleted.
 ERROR 22-322: Expecting a quoted string.  
 ERROR 76-322: Syntax error, statement will be ignored.
 73         run;
 
 74         
 75         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 85         

I understand, okay here are two of those examples straight from the log page. The data set worked fine for generating a model before the estimate phrase was added in.

PaigeMiller
Diamond | Level 26
 72         contrast ’diff among K1 - K5’ strain 0 1 -1 0 0 0,

The "curly" quotes are not recognized by SAS. Probably, you copied code from Microsoft Word or PowerPoint, that's how you wind up with curly quotes. If you change the quotes to the non-curly variety, then I think it should work.

--
Paige Miller

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 521 views
  • 1 like
  • 5 in conversation