BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Solly7
Pyrite | Level 9

Hi, i need help in imputing categoriacla variables.. i tried below code but im not sure which value to use on the 'method' option...i have a variable called 'marital status' consistin of values 'single, married,widowed'...i need to do something like mode imputation

 

proc stdize data=data out=Imputed
oprefix=Orig_ /* prefix for original variables */
reponly /* only replace; do not standardize */
method=; /*ABW, AGK, AHUBER, AWAVE, EUCLEN, IN,IQR, LEAST, MAD, MAXABS, MEAN, MEDIAN, MIDRANGE, RANGE, SPACING, STD, SUM, UST*/
var Marital_status; 
run;
1 ACCEPTED SOLUTION

Accepted Solutions
Sajid01
Meteorite | Level 14

Hello
Imputing character variables has been discussed in this forum topic. Suggest have a look there
https://communities.sas.com/t5/SAS-Programming/Imputing-missing-values-of-character-variables-in-a-l... 

View solution in original post

5 REPLIES 5
PaigeMiller
Diamond | Level 26

From the PROC STDIZE documentation:

 

VAR Statement

 

  • VAR variable;

 

The VAR statement lists numeric variables to be standardized. If you omit the VAR statement, all numeric variables not listed in the BY, FREQ, and WEIGHT statements are used.

 

So PROC STDIZE cannot be used on character variables.

 

To determine the mode of a class variable, you can do this in PROC FREQ and then once you have found the mode, replace missings in your data set with the calculated mode. 

--
Paige Miller
Ksharp
Super User
If I was right PROC STDIZE can't handle category variable.
or maybe @Rick_SAS know more .
Solly7
Pyrite | Level 9

I fully agree, i tried below code...i initially had 24000 rows before applying below code..but thereafter executing the below code my data multiplied to 505000 rows..kindly assist @Rick_SAS 

 

proc mi data=final_data seed=1305417 out=outex7;
   class Existing_cover Marital_status Lead_type;
   fcs discrim(Existing_cover Marital_status Lead_type/details) reg(height_new/details);
   var Existing_cover Marital_status Lead_type height_new;
run;
Rick_SAS
SAS Super FREQ

You need to decide what kind of imputation you want. Originally, you asked about PROC STDIZE, which performs single imputation: missing values of numerical variables are replaced by a value or by a statistic such as the mean or median. But now you are talking about PROC MI, which performs multip[le imputation.

A paper by Paul Allison discusses the various imputation methods for various assumptions of missingness.

 

 

Sajid01
Meteorite | Level 14

Hello
Imputing character variables has been discussed in this forum topic. Suggest have a look there
https://communities.sas.com/t5/SAS-Programming/Imputing-missing-values-of-character-variables-in-a-l... 

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!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 2616 views
  • 1 like
  • 5 in conversation