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
I agree with @Ksharp.
Likeky using the NOTSORTED option is causing an incorrect calculation of the median for your groups.
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
@PeterClemmensen: Yes, that is what I wanted I just need to replace the missing values.
Ah ok, I missread, I thought you actually wanted to standardize your data 🙂
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;
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
201 | 3 | 1 | 0 | 6 | . | . | . |
201 | 2 | 1 | 0 | 9 | . | 43.5 | 72 |
201 | 1 | 1 | 0 | 33 | . | . | 72 |
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;
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;
I agree with @Ksharp.
Likeky using the NOTSORTED option is causing an incorrect calculation of the median for your groups.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.