Skip to content
Prev 375309 / 398500 Next

R is creating a new level which is emty after importing a SAS file

It is not obvious that this is an error. If your nominal variable in SAS has a level which is not present in data, then R might just be making a faithful translation. There is a distinction between (a) having a gender variable with two levels of which 0 females and (b) pretending that male is the only possible gender.

Anyways, droplevels() is your friend. (Notice that it easier to remove levels that you do not want than to insert levels that have been unwantedly deleted on input.) 

-pd