Date: Mon, 15 Nov 1999 21:15:36 GMT
Reply-To: "Daniel J. Nordlund" <dnordlund@AOL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Daniel J. Nordlund" <dnordlund@AOL.COM>
Organization: AOL http://www.aol.com
Subject: Re: Converting to events/trials data format?
Jin Kim <kimjin43@chollian.net> wrote:
>Dear SAS-L
>
>As a SAS novice, I want to know the method how I convert the following
>ordinary data to 'events/trials' data format, which can be used in PROC
>LOGISTIC or GENMOD.
>
>(Of course, I know that above PROCs are possible with ordinary data.
>This question is of educational purpose.)
>
>In the following example data, 'var1-3' are categorical explanatory
>variables, and 'result' is a binary response variable.
>
> var1 var2 var3 result
>obs1 1 1 2 0
>obs2 2 2 2 1
>obs3 3 1 1 0
>obs4 2 2 1 1
>obs5 1 1 2 1
> . . . . .
> . . . . .
> . . . . .
>
>How can I convert the ordinary data like above to 'events/trials'
>format?
>
>Thank you.
>
>Jin Kim
>
You can use PROC SUMMARY to accomplish what you want. In the example,
'yourdata' is your original file. The output file, which I called 'event',
will contain your classification variables and 2 new variables called events
and trials.
proc summary data=yourdata nway;
class var1 var2 var3;
var result;
output out=event(rename=(_freq_=trials) drop=_type_)
sum=events;
run;
Hope this helps,
Dan Nordlund
|