Search code examples
sasmeanproc

PROC MEANS - Save table shown in results and not in Output Data


I have the following code to produce descriptive statistics:

proc means data=sashelp.cars;
    var Horsepower Weight Length;
    output out =  cars_stats mean = std = /autoname;
run;

I would like to get the table shown in the Results tab in the Output Data as I export the tables to Excel later on.

At the moment I get the following in the results:

Table I want to get out

But I get this in the Output Data tab. Table I get in Output Data

How could I get the table from the Results in the Output Data?


Solution

  • Proc MEANS with option STACKODSOUTPUT will produce the same desired table.

    ods select none;
    proc means data=sashelp.cars stackodsoutput;
        var Horsepower Weight Length;
        ods output summary = cars_stats_stacked;
    run;
    ods select all;
    

    enter image description here