Classify variables in Nominal/ordinal/interval/binary in case user inputs not provided?
as a Data Analyst, its your call to consider the categorical column as nominal or ordinal (depending on the data).

if nominal data --> use dummy variable.(or one hot encoding)

if ordinal data --> use map() function for label-encoding.

if nominal data and cardinality is high --> encoding according to frequency count (lets say there are 30 different categories in a column, there are 1000 rows , 3 categories have high frequency count ,so these will be in separate 3 categories, other 17 have very low, so put all these 17 in 1 single category. ie. There will be only 4 categories, not 30).


apart from object type(string) columns, To identify categorical variables:
frequency count plays very important role for numeric columns.
If there is no predefined column types(nominal/interval) stored and some of variables are encoded as 1,2,3... in place of actual Categories (e.g. Good, better, bad....) if we see, automatically it may be classified as interval variables but actually they are nominal variables that are encoded.
Is there any way to identify such variables?
I thought of cardinality but threshold becomes an issue here please suggest some other solution.
I'm good with python solution but if someone can give idea on SAS will be helpful :)