BookmarkSubscribeRSS Feed
thanikondharish
Fluorite | Level 6

data rawdata ;
input ID treatment $ age_GROUP weight ;
cards ;
1 A GRP1 90
2 A GRP1 80
3 A GRP2 90
4 A GRP1 70
5 A GRP2 80
6 A GRP2 80
RUN;

 

how to find slope difference (95% CI) confident interval between two treatment groups with subgroup wise (age group)?

2 REPLIES 2
PaigeMiller
Diamond | Level 26

Please test your code before posting to make sure it works. The code you provided does not work. I request that you fix it.

--
Paige Miller
Rick_SAS
SAS Super FREQ

To answer this question, your data needs three variables: the response variable, the explanatory variable, and a classification (group) variable. Let's use the Sashelp.Class data set and use PROC GLM to fit a linear model that predicts Weight from Height for each age group=13,14,15 year old students.

 

ods graphics on;
proc glm data=sashelp.class(where=(age>12 & age<16)); class age; model weight = height | age / solution clparm; quit;

If you run this code, you will get a graph that shows how the predictions for Weight depend on Height for each Age group. The slopes of each regression line are the parameter estimates for the Height*Age interaction term.

 

You can see that the difference in slope between the Age=13 students and the Age=15 students (the reference group) is -0.73, which means that the Age=13 regression line has a smaller slope than the Age=15 line. The confidence limits for the slope are [-8.7, 7.2], which includes 0, so the difference is not statistically significant.

 

Similarly, the difference in slope between the Age=14 students and the Age=15 students (the reference group) is -0.01, which means that the Age=13 regression line has essentially the same slope as the Age=15 line. The confidence limits for the slope are [-8.7, 8.7], which includes 0, so the difference is not statistically significant.

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 1065 views
  • 1 like
  • 3 in conversation