BookmarkSubscribeRSS Feed
ks94
Obsidian | Level 7

Hi ,

I have a dataset and i want to do a logistic regression. this is the code that i using to do that:


PROC logistic data=africa descending ;
 model FLAG_CRISE_SYSTEMIQUE(event="1")=PAYS
								ANNEE
								FLAG_CRISE_SYSTEMIQUE
								TAUX_CHANGE_USD
								FLAG_DETTE_INTERIEURE
								FLAG_DETTE_EXTERIEURE
								TOTAL_DETTE_PIB
								TAUX_INFLATION
								FLAG_INDEPENDANCE
								FLAG_CRISE_MONETAIRE
								FLAG_CRISE_INFLATION
								fLAG_CRISE_BANCAIRE  
															 ;
class=PAYS; run;

i get an error: << ERROR: Variable PAYS should be either numeric or specified in the CLASS statement.>>

.

Please help me . thanks

 

 

 

5 REPLIES 5
PaigeMiller
Diamond | Level 26

Add this immediately before the MODEL statement:

 

class pays;
--
Paige Miller
ks94
Obsidian | Level 7
NOW I GET THIS ERROR : << Variable FLAG_CRISE_SYSTEMIQUE should be either
numeric or specified in the CLASS statement. >>
JeffMeyers
Barite | Level 11

That would mean that your FLAG_CRISE_SYSTEMIQUE is a character type variable.  Any character type variables either need to be converted to numeric types or listed in the class statement.  Those that are listed in the class statement are considered categorical variables (e.g. 0, 1, 2, 3) and have a reference group that odds ratios are created by comparing to (e.g. 0 vs 3, 1 vs 3, 2 vs 3).  Those not in the class statement must be numeric as they're considered continuous and have an odds ratio created that tests the odds of the event happening given one more unit of the value (e.g. age having the odds of the event given 1 year older).  Something like that anyway (I'm a programmer and not a statistician).

ballardw
Super User

@ks94 wrote:
NOW I GET THIS ERROR : << Variable FLAG_CRISE_SYSTEMIQUE should be either
numeric or specified in the CLASS statement. >>

Look at your data. Any variable that is on the model statement that is not numeric has to be on the class statement.

 

Some procedures will stop looking for other errors when the first error is found when the error is of a certain kind (depends on the procedure). So you could be resolving this error one variable at a time if all of your independent variables are character.

PaigeMiller
Diamond | Level 26

All character variables must be in the CLASS statement.

 

I would not convert them to numbers, this is usually not appropriate in logistic regression.

--
Paige Miller

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1689 views
  • 5 likes
  • 4 in conversation