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

Hi all,

 

I'm working on my thesis and having some trouble figuring out how to run an analysis. I have quintiles of weight change over a 10 year period for a population of about 10,000. I'm looking to run a general linear model with the mean weight change across each quintile as the outcome, but am unsure how to create an outcome variable for this. I am able to find the means weight change across the quintiles, but figuring out how to make those into the outcome variable appropriately is where I'm having some trouble. Any ideas? Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

If you use all 10,000 observations, and the weight change for each observation, then GLM will predict the average weight change in each quintile. (That isn't exactly what you asked for, but it seems to me to be the most sensible approach). Although its not really clear to me the point of modeling a weight change against the quintile of that weight change.

 

Example using a data set of 12 observations

 

data have;
    input id quintile weight;
    cards;
1 1 29
2 1 35
3 1 34
4 2 40
5 2 44
6 2 49
7 3 50
8 3 50
9 4 55
10 4 60
11 5 61
12 5 66
;

proc glm data=have;
    class quintile;
    model weight=quintile;
    means quintile;
run;
quit;

 

Also, I don't really understand this sentence (especially the part that says "mean weight change across each quintile", what is that? Did you really mean to say "mean weight change within each quintile"?):

 

I'm looking to run a general linear model with the mean weight change across each quintile as the outcome

--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

If you use all 10,000 observations, and the weight change for each observation, then GLM will predict the average weight change in each quintile. (That isn't exactly what you asked for, but it seems to me to be the most sensible approach). Although its not really clear to me the point of modeling a weight change against the quintile of that weight change.

 

Example using a data set of 12 observations

 

data have;
    input id quintile weight;
    cards;
1 1 29
2 1 35
3 1 34
4 2 40
5 2 44
6 2 49
7 3 50
8 3 50
9 4 55
10 4 60
11 5 61
12 5 66
;

proc glm data=have;
    class quintile;
    model weight=quintile;
    means quintile;
run;
quit;

 

Also, I don't really understand this sentence (especially the part that says "mean weight change across each quintile", what is that? Did you really mean to say "mean weight change within each quintile"?):

 

I'm looking to run a general linear model with the mean weight change across each quintile as the outcome

--
Paige Miller
Corinthian94
Obsidian | Level 7
To the last question - yes! That's exactly what I meant. I was using my advisors phrasing, but can see how that would be confusing. That makes sense though, I utilized that code and it did exactly what you said. I'm admittedly much less experienced with proc glm than logistic or reg, so I was not even aware means was an option for it. Thank you for the help!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

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

Browse our catalog!

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