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

 Hi All,

 

I am trying impute the missing values for the vairables in a dataset with median by study, treatment and gender using proc stdize.

 

proc stdize data=have out=want missing=median reponly;
var   alti albi asti;
by study notsorted treatment notsorted gender notsorted;
run;

 

But this code gives the following error:

 

WARNING: At least one of the scale and location estimators of variable alti can not be
computed. Variable alti will not be standardized.

 

Please let me know how to resolve this issue.

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

I agree with @Ksharp

Likeky using the NOTSORTED option is causing an incorrect calculation of the median for your groups. 

View solution in original post

9 REPLIES 9
PeterClemmensen
Tourmaline | Level 20

When you use the REPONLY option, PROC STDIZE does not standardize the data, but merely replaces the missing values with the values you specify in your MISSING= option.

 

This is specified in the syntax documentation for PROC STDIZE here

 

https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_stdize_sect...

ari
Quartz | Level 8 ari
Quartz | Level 8

@PeterClemmensen: Yes, that is what I wanted I just need to replace the missing values. 

PeterClemmensen
Tourmaline | Level 20

Ah ok, I missread, I thought you actually wanted to standardize your data 🙂

Rick_SAS
SAS Super FREQ

This could indicate that the ALTI variable does not have a sufficient number of nonzero statistics for one of the BY groups. Change to PROC MEANS and write the mediians to a data set, like in this example (untested):

 

proc means data=have median noprint;
var   alti albi asti;
by study notsorted treatment notsorted gender notsorted;
output out=out median=;
run;

proc print data=out;
where alti=.;
run;
ari
Quartz | Level 8 ari
Quartz | Level 8

@Rick_SAS:

 

Hi Rick, Thanks for this solution, this is the output from the table. I'm  still not sure how to use this table. 

 

                                                        study    treatment gender _TYPE_  _FREQ_ alti        asti        albi 

2013106...
2012109.43.572
20111033..72

 
Rick_SAS
SAS Super FREQ

You "use it" by recognizing what it means. There are three BY groups for which the median is missing. Use a WHERE clause to exclude those BY groups. For example:

 

WHERE stud ^= 201;

Ksharp
Super User

Why you add NOTSORTED ? it is keyword for BY statement, 

I think you should remove it.

 

by study notsorted treatment notsorted gender notsorted;

-->

by study  treatment  gender;

Reeza
Super User

I agree with @Ksharp

Likeky using the NOTSORTED option is causing an incorrect calculation of the median for your groups. 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 9 replies
  • 7168 views
  • 1 like
  • 5 in conversation