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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

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