Search code examples
sas

SAS: PROC UNIVARIATE: Output trimmed mean to dataset


I'm doing the following the output the mean to a datset:

PROC UNIVARIATE DATA=have trimmed=0.05;
VAR age;
by sex;
output out=outputstats mean=theMean;
run;
proc print; run;

How can I output the trimmed mean? I can't find the keyword to request so I can select it.


Solution

  • ODS OUTPUT to the rescue. Use ODS TRACE ON; to find the name.

    proc sort data=sashelp.class out=have;
    by sex;
    
    run;
    
    ods trace on;
    PROC UNIVARIATE DATA=have trimmed=0.05;
    VAR age;
    by sex;
    ods output TrimmedMeans=trimmedMeans;
    run;
    ods trace off;