Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- PROC GLM with Contrast statement

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 10-10-2018 02:03 PM
(4046 views)

Hi all,

I am using PROC GLM Contrast statement to see if my data displays any trend like linear or quadratic. Somehow when I use two CONTRAST statements at the same time, the CONTRAST output does not come out.

Below is my code:

**PROC** **GLM** DATA=mydata;

CLASS RESP_TIME;

MODEL score= RESP_TIME ;

CONTRAST 'Linear' RESP_TIME -**2** -**1** **0** **1** **2**;

CONTRAST 'Quadratic' RESP_TIME **2** -**1** -**2** -**1** **2**;

**run**;

Another question is: is it possible to do the trend plot along with CONTRAST statement?

Thanks a lot!

Lizi

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Although it is possible to fit a quadratic model to only 3 time points, so few points provide very little support for the fit.

SAS Usage Note 22912 illustrates how to acquire coefficients for polynomial contrasts.

I hope this helps.

9 REPLIES 9

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Please post the log from that code. I think GLM may need a QUIT instead of RUN as well, which is why it may not be completing.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thanks Reeza.

I added QUIT, and the log remains as below:

WARNING: More coefficients than levels specified for effect resp_time. Some coefficients will be ignored.

NOTE: CONTRAST Linear is not estimable.

WARNING: More coefficients than levels specified for effect resp_time. Some coefficients will be ignored.

NOTE: CONTRAST Quadratic is not estimable.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Your contrast statements are not correct then. I don't know enough on how to fix those unfortunately. I would expect to run a quadratic model to have to test the quadratic, but I could be totally off base here. I'll move this to the Stat's forum as well.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

@lizzy28 wrote:

Thanks Reeza.

I added QUIT, and the log remains as below:

WARNING: More coefficients than levels specified for effect resp_time. Some coefficients will be ignored.

NOTE: CONTRAST Linear is not estimable.

How many levels of the variable RESP_TIME are there?

Are there levels of RESP_TIME that have no Y values (due to missing data)?

--

Paige Miller

Paige Miller

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you Reeza!

Paige, RESP_TIME has three levels with numeric values 1, 2 and 3, and it has not missing values. Thank you for looking into my question!

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Then you can't specify a CONTRAST statement with 5 levels. You can only specify a CONTRAST statement with 3 levels.

My other question was about your Y variable, in this case SCORE, does it have a lot of missing values such that there is a level of RESP_TIME for which all the Y variables are missing?

--

Paige Miller

Paige Miller

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

I see that I should only set three levels. One further question is how I should decide the L matrix for linear vs quadratic.

Yes, there are about 8% missing values in SCORE.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Although it is possible to fit a quadratic model to only 3 time points, so few points provide very little support for the fit.

SAS Usage Note 22912 illustrates how to acquire coefficients for polynomial contrasts.

I hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

**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.

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.