BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
SASstudent2012
Calcite | Level 5

All,

I am a student and keep getting an error when setting up estimate and contrast statements. I'm trying to build a model for the association between mean glucose and exercise status, and control for possible confounding. Below is the log, and I keep getting this error message "Effects used in the ESTIMATE statement must have appeared previously in the MODEL statement." I don't understand why I keep getting this - the variables 'waist' and 'diabetes' are in the model statement. Does anyone know what I'm doing wrong/can help me out?

Thanks!

89   proc glm data=testdata1;

90   class diabetes;

91   model glucose = waist diabetes/solution;

92   estimate 'diabetes: waist = 80' diabetes 1 -1 waist*diabetes 80 -80;

ERROR: Effects used in the ESTIMATE statement must have appeared previously in the MODEL

       statement.

NOTE: The previous statement has been deleted.

93   estimate 'diabetes: waist = 110' diabetes 1 -1 waist*diabetes 110 -110;

ERROR: Effects used in the ESTIMATE statement must have appeared previously in the MODEL

       statement.

NOTE: The previous statement has been deleted.

94   estimate 'diabetes: waist = 140' diabetes 1 -1 waist*diabetes 140 -140;

ERROR: Effects used in the ESTIMATE statement must have appeared previously in the MODEL

       statement.

NOTE: The previous statement has been deleted.

95   contrast '80 vs. 90'  diabetes 1 -1 waist*diabetes 80 -80, diabetes 1 -1 waist*diabetes 90

95 ! -90;

ERROR: Effects used in the CONTRAST statement must have appeared previously in the MODEL

       statement.

1 ACCEPTED SOLUTION

Accepted Solutions
data_null__
Jade | Level 19

Yes the variables are there but they only define the main effects effect for each variable.  You need to include the interaction effect waist*diabetes.

you can use vertical bar
glucose = waist | diabetes;

View solution in original post

2 REPLIES 2
data_null__
Jade | Level 19

Yes the variables are there but they only define the main effects effect for each variable.  You need to include the interaction effect waist*diabetes.

you can use vertical bar
glucose = waist | diabetes;

SASstudent2012
Calcite | Level 5

Thank you. I updated that line to model glucose = waist exercise waist*exercise/solution;

It worked.

sas-innovate-2024.png

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.

 

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
  • 2 replies
  • 5290 views
  • 0 likes
  • 2 in conversation