BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I have a table that looks like this :

an id duration wt
7401-2001 0 129
7401-2001 167 540
7401-2001 198 652
7401-2001 224 680
7401-2001 246 715
7401-2002 0 94
7401-2002 133 416
7401-2002 169 556
7401-2002 203 644
7401-2002 226 700
7401-2002 247 723

and so on.

The 'anid' is a categorical variable. The goal is to calculate the slope for each anid treating duration as X and weight as Y. That is, a linear regression for each anid.

There are 2000 data rows and 500 different anids. I ran a GLM code on it but this gives me the same slope for each anid , with different intercepts.

I specifically require different slopes for different anids for further growth curve analysis. How to go about it? Please help.
2 REPLIES 2
Doc_Duke
Rhodochrosite | Level 12
Fit a linear model within anid and then output the parameters.

e.g.

PROC GLM;
BY anid;
MODEL wt=duration;

You can output the slope an intercept with either ODS or an OUTPUT statement. The classical growth curve analysis (Wishert), requires the same time intervals (number and placement) so you can put all the wt's on the left hand side of the model and fit the curve within the times. IF you have that situation (you don't), this method is algebraically equivalent.


Message was edited by: Doc@Duke
deleted_user
Not applicable
Thanks for the reply. It worked great. I have worked on logistic models before, its my first tryst with ODS output.

I am trying to get the output into excel. ODS gives a lot of options. But each of them has a lot of unwanted result. The final excel table I am looking to compile has only 3 columns:
an id, slope, intercept

Thats it. Anyway I can just extract slope and intercept only from the output and chuck the other inferences which I do not need at the moment?

With 4 other files like this, I am looking at a formatting nightmare otherwise!!

Thanks again.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 849 views
  • 0 likes
  • 2 in conversation