Date: Mon, 27 Sep 2010 06:56:11 -0500
Reply-To: "Data _null_;" <iebupdte@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Data _null_;" <iebupdte@GMAIL.COM>
Subject: Re: Easier way to produce tables
In-Reply-To: <201009270948.o8R7OqZY028196@willow.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1
Maybe you can just transpose.
data test;
array pred[10];
do id = 1 to 10;
do i = 1 to dim(pred);
pred[i] = rantbl(1234,.5)-1;
end;
y = rannor(0) * 5 + 10;
output;
end;
run;
proc transpose name=table out=test2(rename=col1=pred);
by id y;
var pred:;
run;
proc sort data=test2 SORTSEQ=LINGUISTIC(NUMERIC_COLLATION=ON);
by table;
run;
proc summary data=test2;
by table;
class pred;
var y;
output out=tables;
run;
proc print;
run;
On Mon, Sep 27, 2010 at 4:48 AM, SUBSCRIBE SAS-L Olivier Van Parys
<olivier.vanparys@gmail.com> wrote:
> Hi Folks,
>
> I am trying to change a bad habit I have have acquired, when checking
> predictor in a model with Y as the variable to predict and Pred1... PredN
> representing N binomial predictors - I usually run the following:
> proc summary data=DB;
> class Pred1;
> var Y;
> output out=table_pred1;
> ...
> proc summary data=DB;
> class PredN;
> var Y;
> output out=table_predN;
>
> That give me N table which I then collate back together using excel. This
> obviously ends up being a rather time consuming & tedious process. I was
> wondering what would be a better /more efficient syntax to produce the final
> table (i.e. A single table with Predictors on each row showing the average Y
> when Pred=1 or Pred=0).
>
> Thanks again for your tips,
>
> Olivier
>
|