BookmarkSubscribeRSS Feed
edasdfasdfasdfa
Quartz | Level 8

I read the following (below) in some article on here:

 

For categorical variables, the most common methodology is “count” wherein you fill the missing values with the most common level of the categorical variable.

 

How is this performed? I can't find any information on it.

3 REPLIES 3
ballardw
Super User

One very crude method: Proc Freq plus a data step. Find the most frequent occurrence using proc freq then something like:

 

Data want;

   set have;

   if missing(var) then var='mostcommonvalue';

run;

 

Similar for replacing with a Mean value, proc means/summary to get the mean and replace missing values.

edasdfasdfasdfa
Quartz | Level 8

For numeric variables, you can use proc stdize but I have never seen documentation on character variables.

 

Ie

 

proc stdize data=train

method=median out=traini

var var1

run;

Reeza
Super User

You need to first understand how and why the values are missing before you can say what an appropriate method is. Using the largest group isn't a great method. An alternative is to actually model the data to predict the category - using logistic regression or discriminant analysis. These are both covered in PROC MI and both have examples in the documentation, 79.4 & 79.5 Examples

 

https://documentation.sas.com/?docsetId=statug&docsetTarget=statug_mi_examples04.htm&docsetVersion=1...

 


@edasdfasdfasdfa wrote:

I read the following (below) in some article on here:

 

For categorical variables, the most common methodology is “count” wherein you fill the missing values with the most common level of the categorical variable.

 

How is this performed? I can't find any information on it.


 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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