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

Hello,

I computed multinomial logit regression parameters using proc logistic:

 

proc sort data=edu.educationClean;by EU15 sex;run;
proc logistic data=edu.educationClean;
class cohort2(ref='2') Langue(ref='0') cntr_regr(ref=first) genstat3(ref='0') eduM3(ref='2') religion(ref='0') /param=ref;
model edu3(ref='2')= cntr_regr cohort2 cntr_regr*cohort2 Langue genstat3 religion eduM3  /link=glogit rsquare;
weight pond / norm;
by EU15 sex;
where model=1;
run;

 

I would like to use parameters to predict values of edu3 in another dataset  (donnees.popbase2) which has the same shape, but a different population. Is it possible?

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Yes. This is called "scoring," and you can read about how to do it in the article "Techniques for scoring a regression model in SAS."

 

For your situation, I suggest using the STORE statement and the PLM procedure. To your PROC LOGISTIC code, add the SCORE statement, then use the SCORE statement in PROC PLM.  There is an example in the article.

View solution in original post

5 REPLIES 5
Rick_SAS
SAS Super FREQ

Yes. This is called "scoring," and you can read about how to do it in the article "Techniques for scoring a regression model in SAS."

 

For your situation, I suggest using the STORE statement and the PLM procedure. To your PROC LOGISTIC code, add the SCORE statement, then use the SCORE statement in PROC PLM.  There is an example in the article.

Demographer
Pyrite | Level 9

Thank you. I tried this:

 

proc sort data=edu.educationClean;by EU15 sex;run;
proc logistic data=edu.educationClean;
class cohort2(ref='2') cntr_regr(ref=first) genstat3(ref='0') eduM3(ref='2') religion(ref='0') /param=ref;
model edu3(ref='2')= cntr_regr cohort2 cntr_regr*cohort2 genstat3 religion eduM3  /link=glogit rsquare;
weight pond / norm;
where model=1;
by EU15 sex;
store work.regout;
run;

 

proc plm restore=work.regout;
   score data=edu.missing_countr;

   by EU15 sex;
run;

 

There is an error message saying "At least one variable used in the model is not present or has incompatible type in the EDU.MISSING_COUNTR score data set"

I noted that the dataset regout doesn't appear in the work folder. What I did wrong?

 

Rick_SAS
SAS Super FREQ

REGOUT is not a data set. It is an item store.

 

The error message is reminding you that the data set that you are attempting to score must have every  variable that is in the model. You can use

 

PROC CONTENTS SHORT data=edu.missing_countr; run;

 

to see which variables are in the scoring data and (more importantly) which are not.

Demographer
Pyrite | Level 9

Right... the label of the weight variable was not the same.

Now I have values in the predicted value column, but I am not totally sure what they mean. I was expecting having probabilities for the 3 modalities of the dependent variable, but I have values such as

 

Ordinal Response Predicted value
0 -1.79479
1 -1.18285
2 0
Demographer
Pyrite | Level 9

Nevermind, I had to add out=testout predicted/ilink;

Now it works. Thank you.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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