Date: Wed, 19 Sep 2007 18:16:59 -0400
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject: Re: Proc Means Output to table (nicely)
On Wed, 19 Sep 2007 12:23:01 -0700, Syb it <sas_datalover@YAHOO.COM> wrote:
>Dear forumites,
>
> I am trying to figure out a decent way of outputting Proc MEans output
onto a SAS table so that my results are preserved in a clean away and get
rid of stuff i dont need.
>
> You not that if you use the noprint option and instead Output out = dataset;
>
> the Output has variables like _Type_ _freq_ _stat_.. at least I need to
transpose these.. proc tranpose might work.. but i am curious to know how
others have handled it. Example code appreciated as always :) :)
Use the DROP= data set option. For example:
proc means data=sashelp.class noprint;
output out=means_out(drop = _type_ _freq_);
run;
You get:
Obs _STAT_ Age Height Weight
1 N 19.0000 19.0000 19.000
2 MIN 11.0000 51.3000 50.500
3 MAX 16.0000 72.0000 150.000
4 MEAN 13.3158 62.3368 100.026
5 STD 1.4927 5.1271 22.774
Then, as you mentioned, you can transpose:
proc transpose data=means_out out=transpose_out;
id _stat_;
run;
You get:
Obs _NAME_ N MIN MAX MEAN STD
1 Age 19 11.0 16 13.316 1.4927
2 Height 19 51.3 72 62.337 5.1271
3 Weight 19 50.5 150 100.026 22.7739