BookmarkSubscribeRSS Feed
battsetseg
Calcite | Level 5

Hello,

 

I would like to run the proc reg procedure stratified by some categorical variables.

this is what I did without stratification: 

 

Proc reg data=DATA; Model DEPENDENT=independent_1 ; run;

 

Now, I would like to calculate the estimated effect of the variable "independent_1" on DEPENDENT  but stratified by Independent_2. "Independent_2" variable has four categories (0, 1, 2, 3). I would like to see for Independent_2=0 then what is the estimated effect of the variable "independent_1" on DEPENDENT.

 

Thank you

 

Batts

 

 

3 REPLIES 3
PaigeMiller
Diamond | Level 26

You can create regressions by categorical variable with the same slope across each level of the categorical variable, or you can four regressions with different slopes.

 

proc glm data=data;
    class independent_2;
    model dependent = independent_1 independent_2
        independent_1*independent_2
        /solution;
run;

This gives four different slopes. If you want them to have the same slopes, remove independent_1*independent_2

--
Paige Miller
battsetseg
Calcite | Level 5
PaigeMiller,

Thank you for the suggestion. I run my code but it is not showing any estimate effects. So I would like to see the estimated effect of "Independent_1" on "Dependent" by if each category/level of "independent_2" (this has for levels 0,1,2,3).
For example: When "independent_2" = 0 what is the estimate effect of "Independent_1" on "Dependent".

When "independent_2" = 1 what is the estimate effect of "Independent_1" on "Dependent".

For example: When "independent_2" = 2 what is the estimate effect of "Independent_1" on "Dependent".

For example: When "independent_2" = 3 what is the estimate effect of "Independent_1" on "Dependent".

I would like to see the estimate effect, CI, P-value, and Number of observations used in each of these results.

thank you very much!
PaigeMiller
Diamond | Level 26

Did you use the /SOLUTION option? If so, the estimates should be shown in the output.

 

Please show us the code you used. (Click on the running man icon and paste the code into that window)

 

Please show us the output you obtained.

--
Paige Miller

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

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
  • 3 replies
  • 1435 views
  • 0 likes
  • 2 in conversation