BookmarkSubscribeRSS Feed
KKIND
Obsidian | Level 7

What is the equivalent of slice statement in a negative binomial regression model? 

5 REPLIES 5
Ksharp
Super User

Did you try SLICE statement of PROC GENMOD ?

another way is using LSMEANS + AT option

and another way is using EFFECTPLOT statement like:

 

data insure;
input n c car$ age;
carnum=1;
if car="medium" then carnum=2;
if car="large" then carnum=3;
ln = log(n);
datalines;
500 42 small 1
1200 37 medium 1
100 1 large 1
400 101 small 2
500 73 medium 2
300 14 large 2
;
proc genmod data=insure;
class  age;
model c = carnum age / dist=NEGBIN link=log ;
effectplot slicefit(x=carnum sliceby=age) / clm ;
run;

Ksharp_0-1714786119837.png

 

KKIND
Obsidian | Level 7

@Ksharp, many thanks! I will try your sample code and revert back asap. Have a great day!

 

Best

KKIND

KKIND
Obsidian | Level 7

Re: How to use VS Code with SAS OnDemand for Academics 

when I used the slice statement with multinomial logistic regression as follows.

C:\Users\kiran\OneDrive\HCUP-DBs\NEDS_2019\";

proc logistic data = NEDS.neds_2019_pneumonia_recat;

class died_visit (ref = "1") pay1recat (ref = "3") hosp_controlrecat (ref = "4") pl_nchsrecat (ref = "1") / param = glm;

model died_visit = pay1recat hosp_controlrecat pay1recat*hosp_controlrecat aweekend female pl_nchsrecat / link = glogit;

slice pay1recat*hosp_controlrecat/sliceby(pay1recat='3') diff oddsratio cl;

slice pay1recat*hosp_controlrecat/sliceby(pay1recat='2') diff oddsratio cl;

slice pay1recat*hosp_controlrecat/sliceby(pay1recat='1') diff oddsratio cl;

slice pay1recat*hosp_controlrecat/sliceby(hosp_controlrecat='1') diff oddsratio cl;

slice pay1recat*hosp_controlrecat/sliceby(hosp_controlrecat='2') diff oddsratio cl;

slice pay1recat*hosp_controlrecat/sliceby(hosp_controlrecat='3') diff oddsratio cl;

slice pay1recat*hosp_controlrecat/sliceby(hosp_controlrecat='4') diff oddsratio cl;

run;

one of the output tables I got and was looking for is

KKIND_0-1714936159387.png

Per my research question, I am looking at within hospital variation in outcomes by payer type (1=Medicare; 2=Medicaid; and 3= private insurance). From this output above, I can determine what is the difference in outcomes comparing between each payer type for each level of the hospital ownership type (hosp_controlrecat). Is there some way I can get similar outputs (comparing between payer types) under the proc genmod code? Thank you!

 

Best

KKIND

 

 

Ksharp
Super User

Did you try SLICE statement?

data insure;
input n c car$ age;
carnum=1;
if car="medium" then carnum=2;
if car="large" then carnum=3;
ln = log(n);
datalines;
500 42 small 1
1200 37 medium 1
100 1 large 1
400 101 small 2
500 73 medium 2
300 14 large 2
;
ods select  SliceDiffs;
proc genmod data=insure;
class  carnum age;
model c = carnum|age / dist=NEGBIN link=log offset=ln;
slice carnum*age /sliceby=age diff cl  ;
run;

Ksharp_0-1714960880104.png

 

 

Or @StatDave  could give you a hand.

KKIND
Obsidian | Level 7

Dear Ksharp,

 

Thanks again for your efforts and sharing the code. I tried using it bit still couldn't get the output as you shared. 

 

Best

KKind

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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