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
Add this immediately before the MODEL statement:
class pays;
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).
@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.
All character variables must be in the CLASS statement.
I would not convert them to numbers, this is usually not appropriate in logistic regression.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.