BookmarkSubscribeRSS Feed
SAS_User
Calcite | Level 5
I would like to specify a value of '1' to my slope and estimate the intercept. Is there a way to do that in proc GLM or another proc?
Thanks
6 REPLIES 6
SteveDenham
Jade | Level 19
I suppose that you currently have something like:

proc glm data=one;
model y=x;
run;

if so, then try:

data two;
set one;
diff=y-x;
run;

proc glm data=two;
model diff=;
run;

The standard error of the estimate will be slightly biased, but the point estimate should be OK.

Steve Denham
SAS_User
Calcite | Level 5
I finally got around to trying the code and it worked really well for my requirement.
Thanks to both of you for the suggestions. the code that I used was the first one that Steve suggested - proc glm modeling the difference.

Thanks for the help!
Dale
Pyrite | Level 9
Many of the SAS procedures which allow you to fit a regression model allow specification of an "offset" parameter. The GLM procedure is one of the procedures which allow specification of an offset parameter. When you specify that a variable is an offset parameter, then that variable enters the right hand side of the model with slope coefficient fixed at 1.

With the GLM procedure, code for fitting a regression model including an offset parameter would be something like the following:

proc glm data=mydata;
   class x1 x2;
   model y = x1 x2 x3 / offset=z s;
run;

In the above code, there is a variable Z which is to have a slope coefficient of 1. It should be pointed out that you can only name one variable as being an offset parameter. The documentation for the GLM procedure also states that "This variable cannot be a CLASS variable, and it cannot be the response variable or one of the explanatory variables." Only a moments thought would prove that all of these conditions make sense.
SteveDenham
Jade | Level 19
Dale,

Did you mean GLIMMIX, rather than GLM? I got sensible answers from GLIMMIX, but only error messages from GLM. Maybe I missed something in the syntax.

Steve Denham
SAS_User
Calcite | Level 5
Thank you all so much for you responses. I have not had a chance to try any of your suggestions yet but will do so soon and let you know. Thanks again for the help.
Dale
Pyrite | Level 9
Steve,

I think that I must have clicked on the GENMOD procedure rather than the GLM procedure in the SAS documentation. I thought it was a bit odd that there would be an OFFSET parameter in GLM. I should have double-checked. The GLIMMIX procedure also supports an OFFSET parameter specification. However, not everyone has GLIMMIX installed.

If GLIMMIX is available, the code which I showed previously would work directly with only a change of the procedure name from GLM to GLIMMIX. If GLIMMIX is not available and GENMOD is employed, then one would need to remove the option S from the model statement.

Thus, we would write either:

proc glimmix data=mydata;
   class x1 x2;
   model y = x1 x2 x3 / offset=z s;
run;

or

proc genmod data=mydata;
   class x1 x2;
   model y = x1 x2 x3 / offset=z;
run;

Dale

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!

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.

Discussion stats
  • 6 replies
  • 1396 views
  • 0 likes
  • 3 in conversation