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

Hi everyone! Hope my title makes sense! I'm trying to build a code using forward selection process that has a multinomial response variable! I tried using proc glmselect and proc hpgenselect, but I get error messages since my response variable isn't numeric.

 

I'm looking to determine how likely people are going to visit a hospital based on variables such as education, work, income, etc. The visit hospital variable has 5 categories (none, most likely none, neutral, most likely yes, yes).

 

Let me know if it's even possible at all! And what other method I should use! Thanks!

proc hpgenselect data=factorshospital;
	class education_cat(ref="0") work_cat(ref="0");
   model visits_cat = education_cat work_cat;
   selection method=forward;
run;

Here is the log of the error

1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 68         
 69         proc glmselect data=factorshospital;
 70         class education_cat(ref="0") work_cat(ref="0");
 71            model visits_cat = education_cat work_cat
 ERROR: Variable visits_cat in list does not match type prescribed for this list.
 72             / selection=forward;
 73         run;
 
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE GLMSELECT used (Total process time):
1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

Since your Y variable is ordinal not nominal , I think you should recode it by 1,2,3 and specify the right distribution and link function .

 


data have;
 set sashelp.heart;
 if bp_status='High' then y=1;
  else if bp_status='Normal' then y=2;
   else if bp_status='Optimal' then y=3;
run;

proc hpgenselect data=have;
	class sex Smoking_Status;
   model y = sex Smoking_Status weight height ageatstart/dist= MULTINOMIAL link=cll;
   selection method=forward;
run;

Ksharp_0-1732239833836.png

 

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

@chester2018 wrote:

Hi everyone! Hope my title makes sense! I'm trying to build a code using forward selection process that has a multinomial response variable! I tried using proc glmselect and proc hpgenselect, but I get error messages since my response variable isn't numeric.

 

I'm looking to determine how likely people are going to visit a hospital based on variables such as education, work, income, etc. The visit hospital variable has 5 categories (none, most likely none, neutral, most likely yes, yes).

 

proc hpgenselect data=factorshospital;
	class education_cat(ref="0");
   model visits_cat = education_cat;
   selection method=forward;
run;

 


Whenever you get an error, show us the log for this PROC. We need to see the log from the PROC HPGENSELECT statement down to the last NOTE after the PROC ends, every single line in the log in this range.

 

Why would you want to do a forward selection with only one X variable?

--
Paige Miller
chester2018
Obsidian | Level 7

I plan to do the forward selection method with the additional variables, like work, income, etc. I made the edits in my post.

 

This is the error message "ERROR: Variable visits_cat in list does not match type prescribed for this list"

Ksharp
Super User

Since your Y variable is ordinal not nominal , I think you should recode it by 1,2,3 and specify the right distribution and link function .

 


data have;
 set sashelp.heart;
 if bp_status='High' then y=1;
  else if bp_status='Normal' then y=2;
   else if bp_status='Optimal' then y=3;
run;

proc hpgenselect data=have;
	class sex Smoking_Status;
   model y = sex Smoking_Status weight height ageatstart/dist= MULTINOMIAL link=cll;
   selection method=forward;
run;

Ksharp_0-1732239833836.png

 

chester2018
Obsidian | Level 7

Thank you so much! This makes sense!!

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1188 views
  • 0 likes
  • 3 in conversation