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

Hi,

I have a dataset like the one below, where Lag_level and Level can take any value from {0,1,2,3,4} and LOS_category takes values from set  {1,2,3,4}.

 

Lag_level  Level  LOS_category

0                1        1

4                2         2

I am trying to estimate the probability of Level as the dependent variable and independent variables are  Lag_level  and LOS_category. I used ordered multinomial logit regression with the following code.

proc logistic data =have;
class lag_level (param = ref ref="4") LOS_category(param = ref ref="4");
model Level (descending)=lag_level  LOS_category /unequalslopes=(lag_level);
output out=outreg  predicted=p1;
store  out=Level_transition;
run;

Now I want to predict the (individual) probabilities (as opposed with cumulative probabilities) for a test dataset like this:

data test2;
   input lag_level  LOS_category;
   datalines;
0 1
1 1
2 1
3 1
4 1
0 3
1 3
2 4
3 3
4 2
;

I tried to use proc plm and restore the model as follows:

proc plm restore=level_transition;
   score data=test2 out=testout2 predicted / ilink;
run;
proc print data=testout2;
run;

But then I received an error "ERROR: The file WORK.LEVEL_TRANSITION does not exist or it is not a valid item store." Because these procedure works for standard logistic regression, I was wondering if anybody can help with this cumulative multinomial one.

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

If you want to do it in a single call, you can use the SCORE statement

 


proc logistic data =Have;
class lag_level (param = ref ref="4") LOS_category(param = ref ref="4");
model Level (descending)=lag_level  LOS_category /unequalslopes=(lag_level);
output out=outreg  predicted=p1;
SCORE data=test2 out=pred;
run;

proc print data=pred;
run;

View solution in original post

4 REPLIES 4
Rick_SAS
SAS Super FREQ

I believe the problem is that you are using the UNEQUALSLOPES option. The doc for the LOGISTIC PROCEDURE says,

"The STORE statement is not available for models created with the LINK=ALOGIT option, the EQUALSLOPES or UNEQUALSLOPES options, a STRATA statement, or an EXACT statement."

 

You can work around the problem by removing the option.  You can create a separate PROC LOGISTIC call that performs the unequal slopes analysis but does not contain the STORE statement.

Bright
Obsidian | Level 7

Thanks for the reply. So do you know any other way that I can estimate probabilities?

Rick_SAS
SAS Super FREQ

If you want to do it in a single call, you can use the SCORE statement

 


proc logistic data =Have;
class lag_level (param = ref ref="4") LOS_category(param = ref ref="4");
model Level (descending)=lag_level  LOS_category /unequalslopes=(lag_level);
output out=outreg  predicted=p1;
SCORE data=test2 out=pred;
run;

proc print data=pred;
run;

Bright
Obsidian | Level 7

Thanks for your help!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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