BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
drkd
Calcite | Level 5

Hello Gurus,

I'm trying to impute height & weight of row 128 in this dsn but not sure what I am missing.... I can't seem to impute these 2 columns in obs 128.   Any ideas?

DATA HEART;SET SASHELP.HEART;RUN;
PROC PRINT DATA=HEART(FIRSTOBS=126 OBS=130);TITLE 'BEFORE IMPUTING';RUN;
proc mi data=HEART seed=12345 nimpute=5 out=HEART_mi; var HEIGHT WEIGHT;RUN;
PROC PRINT DATA=HEART_MI(FIRSTOBS=126 OBS=130);TITLE 'AFTER IMPUTING';RUN;

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Look at the Missing Data Patterns table:

Junk.JPG

It shows that there are two observations for which BOTH Height and Weight are missing. The imputation does not impute those records. For other records, the procedure can estimate the joint distribution of Height and Weight and conditionally impute one missing value when the other variable is nonmissing.

 

One way to get imputed values when both Height and Weight are missing is to include a third variable. For example, if you think that joint distribution of heights and weights might be dependent on the SEX  variable, you can use

proc mi data=HEART seed=12345 nimpute=5 out=HEART_mi;
class SEX; 
var HEIGHT WEIGHT SEX;
FCS;
RUN;

 

View solution in original post

4 REPLIES 4
Rick_SAS
SAS Super FREQ

Look at the Missing Data Patterns table:

Junk.JPG

It shows that there are two observations for which BOTH Height and Weight are missing. The imputation does not impute those records. For other records, the procedure can estimate the joint distribution of Height and Weight and conditionally impute one missing value when the other variable is nonmissing.

 

One way to get imputed values when both Height and Weight are missing is to include a third variable. For example, if you think that joint distribution of heights and weights might be dependent on the SEX  variable, you can use

proc mi data=HEART seed=12345 nimpute=5 out=HEART_mi;
class SEX; 
var HEIGHT WEIGHT SEX;
FCS;
RUN;

 

drkd
Calcite | Level 5
Thanks Rick! That helped.
vsandoval6
Calcite | Level 5

Please help with this probelem

Tabulate the percent of observations in the SASHELP.HEART dataset that have non-missing values for all the predictor variables that you will use in later analyses: AgeAtStart, BP_Status, Chol_Status, Cholesterol, Diastolic, Height, MRW, Sex, Smoking, Smoking_Status, Systolic, Weight, and Weight_Status.

Rick_SAS
SAS Super FREQ

Since this sounds like a school assignment, I will give you a hint rather than a complete SAS program. You can get your answer by reading the article "Count the number of missing values for each variable."

 

The article shows how to get counts. To get percentages also, just remove the NOPERCENT option on the TABLES statement in PROC FREQ.

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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 813 views
  • 2 likes
  • 3 in conversation