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

Here is the code I have for categorical independent variables, comparing across all levels of each variable.

proc logistic data = NEDS.neds_2016_pneumonia_recat;
class died_visit (ref = "0") pay1recat (ref = "3") hosp_traumarecat (ref = "0") / param = glm;
model died_visit = pay1recat hosp_traumarecat pay1recat*hosp_traumarecat / link = glogit;
slice pay1recat*hosp_traumarecat/sliceby(pay1recat='3') diff oddsratio cl;
slice pay1recat*hosp_traumarecat/sliceby(pay1recat='2') diff oddsratio cl;
slice pay1recat*hosp_traumarecat/sliceby(pay1recat='1') diff oddsratio cl;
slice pay1recat*hosp_traumarecat/sliceby(hosp_traumarecat='0') diff oddsratio cl;
slice pay1recat*hosp_traumarecat/sliceby(hosp_traumarecat='1') diff oddsratio cl;
slice pay1recat*hosp_traumarecat/sliceby(hosp_traumarecat='2') diff oddsratio cl;
slice pay1recat*hosp_traumarecat/sliceby(hosp_traumarecat='3') diff oddsratio cl;
run;

Is the following code okay for a continuous variable such as age?

slice pay1recat*age/sliceby(pay1recat='3') diff oddsratio cl;
slice pay1recat*age/sliceby(pay1recat='2') diff oddsratio cl;
slice pay1recat*age/sliceby(pay1recat='1') diff oddsratio cl;

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
sbxkoenk
SAS Super FREQ

Have just moved this to "Statistical Procedures" - board.

View solution in original post

6 REPLIES 6
sbxkoenk
SAS Super FREQ

Have just moved this to "Statistical Procedures" - board.

KKIND
Obsidian | Level 7
Thank you sbxkoenk!
sbxkoenk
SAS Super FREQ

@KKIND wrote:

Is the following code okay for a continuous variable such as age?

slice pay1recat*age/sliceby(pay1recat='3') diff oddsratio cl;
slice pay1recat*age/sliceby(pay1recat='2') diff oddsratio cl;
slice pay1recat*age/sliceby(pay1recat='1') diff oddsratio cl;

Thank you!


No.
You will get an ERROR.
ERROR: Only CLASS variables allowed in this effect.

See
SAS/STAT® 15.2 User's Guide
Shared Concepts and Topics
SLICE Statement
https://go.documentation.sas.com/doc/en/statug/15.2/statug_introcom_sect064.htm


It says :
"The SLICE statement is similar to the LSMEANS statement. You use it to perform inferences on model effects that consist entirely of classification variables. With the SLICE statement, these effects must be higher-order effects of at least two classification variables."

 

Koen

KKIND
Obsidian | Level 7
Thanks again Koen!
StatDave
SAS Super FREQ

You don't need the SLICE statement to assess the effect of AGE at each level of the interacting categorical predictor. You can do that using the ODDSRATIO statement. For example:

oddsratio age;

BTW, this note discusses assessing the effect of a continuous variable in any generalized linear model. As noted there, particularly in the example of a continuous-categorical interaction in a log-linked model, you can also use the Margins macro. That macro is used to both fit the model and provided the assessment.

KKIND
Obsidian | Level 7
Thanks much StatDave!

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

Register now

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