- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I agree with @Ksharp.
Likeky using the NOTSORTED option is causing an incorrect calculation of the median for your groups.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@PeterClemmensen: Yes, that is what I wanted I just need to replace the missing values.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Ah ok, I missread, I thought you actually wanted to standardize your data 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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 |
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I agree with @Ksharp.
Likeky using the NOTSORTED option is causing an incorrect calculation of the median for your groups.