Hi all,
I am faced with what should be a pretty simple task but the solution
escapes me at the moment. I have a SAS file with the following 4
variables: ID Rater1 Rater2 Rater3. I would like to conduct a multiple
rater kappa analysis using the macro developed by SAS. However, they
require a different data structure. Specifically, the macro needs a
dataset with the following 3 variables: ID Rater Response. Can someone
provide me with a snippet of code for restructuring the following data
ID Rater1 Rater2 Rater3
00001 1 2 3
00002 4 5 6
Into
ID Rater Response
00001 1 1
00001 2 2
00001 3 3
00002 1 4
00002 2 5
00002 3 6
Thanks,
Cristian
|
|
0
|
|
|
|
Reply
|
crisgugiu (90)
|
1/4/2010 6:20:46 PM |
|
data have;
input
ID $ Rater1 Rater2 Rater3;
cards;
00001 1 2 3
00002 4 5 6
;
run;
data want;
set have;
array temp {*} rater:;
do _n_=1 to dim(temp);
rater=_n_;
response=temp(_n_);
output;
end;
drop rater1-rater3;
run;
proc print;
run;
HTH
Yu
On Mon, Jan 4, 2010 at 12:20 PM, P. Cristian Gugiu <crisgugiu@yahoo.com>wrote:
> Hi all,
>
> I am faced with what should be a pretty simple task but the solution
> escapes me at the moment. I have a SAS file with the following 4
> variables: ID Rater1 Rater2 Rater3. I would like to conduct a multiple
> rater kappa analysis using the macro developed by SAS. However, they
> require a different data structure. Specifically, the macro needs a
> dataset with the following 3 variables: ID Rater Response. Can someone
> provide me with a snippet of code for restructuring the following data
>
> ID Rater1 Rater2 Rater3
> 00001 1 2 3
> 00002 4 5 6
>
> Into
>
> ID Rater Response
> 00001 1 1
> 00001 2 2
> 00001 3 3
> 00002 1 4
> 00002 2 5
> 00002 3 6
>
> Thanks,
> Cristian
>
|
|
0
|
|
|
|
Reply
|
zhangyu05 (659)
|
1/4/2010 6:24:47 PM
|
|
Cristian
Proc Transpose will do this nicely
Data RaterWide;
input ID Rater1 Rater2 Rater3;
cards;
00001 1 2 3
00002 4 5 6
run;
Proc Transpose data = RaterWide Out = Skinny ( Rename = ( Col1 = Response _Name_ = Rater )) ;
var Rater: ; * use any variable with the prefix of Rater;
by id;
run;
Note that the variable Rater will have a label of _Name_.
Nat Wooding
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of P. Cristian Gugiu
Sent: Monday, January 04, 2010 1:21 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Reading in a SAS dataset
Hi all,
I am faced with what should be a pretty simple task but the solution
escapes me at the moment. I have a SAS file with the following 4
variables: ID Rater1 Rater2 Rater3. I would like to conduct a multiple
rater kappa analysis using the macro developed by SAS. However, they
require a different data structure. Specifically, the macro needs a
dataset with the following 3 variables: ID Rater Response. Can someone
provide me with a snippet of code for restructuring the following data
ID Rater1 Rater2 Rater3
00001 1 2 3
00002 4 5 6
Into
ID Rater Response
00001 1 1
00001 2 2
00001 3 3
00002 1 4
00002 2 5
00002 3 6
Thanks,
Cristian
CONFIDENTIALITY NOTICE: This electronic message contains
information which may be legally confidential and or privileged and
does not in any case represent a firm ENERGY COMMODITY bid or offer
relating thereto which binds the sender without an additional
express written confirmation to that effect. The information is
intended solely for the individual or entity named above and access
by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying, distribution, or use of the
contents of this information is prohibited and may be unlawful. If
you have received this electronic transmission in error, please
reply immediately to the sender that you have received the message
in error, and delete it. Thank you.
|
|
0
|
|
|
|
Reply
|
nathaniel.wooding (1453)
|
1/4/2010 7:02:34 PM
|
|
That did the trick. Thanks!!!=0A=0ACristian=0A=0A=0A=0A=0A_________________=
_______________=0AFrom: Yu Zhang <zhangyu05@gmail.com>=0ATo: P. Cristian Gu=
giu <crisgugiu@yahoo.com>=0ACc: SAS-L@listserv.uga.edu=0ASent: Mon, January=
4, 2010 1:24:47 PM=0ASubject: Re: Reading in a SAS dataset=0A=0Adata have;=
=0Ainput =0AID $=A0=A0 Rater1=A0 Rater2=A0 Rater3;=0Acards;=0A00001=A0=A0 1=
=A0=A0=A0=A0=A0=A0=A0 2=A0=A0=A0=A0=A0 3=0A00002=A0=A0 4=A0=A0=A0=A0=A0=A0=
=A0 5=A0=A0=A0=A0=A0 6=0A;=0Arun;=0A=0Adata want;=0Aset have;=0Aarray temp =
{*} rater:;=0A=0Ado _n_=3D1 to dim(temp);=0Arater=3D_n_;=0Aresponse=3Dtemp(=
_n_);=0Aoutput;=0Aend;=0Adrop rater1-rater3;=0Arun;=0A=0Aproc print;=0Arun;=
=0A=0AHTH=0A=0AYu=0A=0A=0AOn Mon, Jan 4, 2010 at 12:20 PM, P. Cristian Gugi=
u <crisgugiu@yahoo.com> wrote:=0A=0AHi all,=0A>=0A>I am faced with what sho=
uld be a pretty simple task but the solution=0A>escapes me at the moment. I=
have a SAS file with the following 4=0A>variables: ID Rater1 Rater2 Rater3=
.. I would like to conduct a multiple=0A>rater kappa analysis using the macr=
o developed by SAS. However, they=0A>require a different data structure. Sp=
ecifically, the macro needs a=0A>dataset with the following 3 variables: ID=
Rater Response. Can someone=0A>provide me with a snippet of code for restr=
ucturing the following data=0A>=0A>ID =A0 =A0Rater1 =A0Rater2 =A0Rater3=0A>=
00001 =A0 1 =A0 =A0 =A0 =A02 =A0 =A0 =A03=0A>00002 =A0 4 =A0 =A0 =A0 =A05 =
=A0 =A0 =A06=0A>=0A>Into=0A>=0A>ID =A0 =A0 Rater =A0 Response=0A>00001 =A0 =
=A01 =A0 =A0 =A0 =A0 1=0A>00001 =A0 =A02 =A0 =A0 =A0 =A0 2=0A>00001 =A0 =A0=
3 =A0 =A0 =A0 =A0 3=0A>00002 =A0 =A01 =A0 =A0 =A0 =A0 4=0A>00002 =A0 =A02 =
=A0 =A0 =A0 =A0 5=0A>00002 =A0 =A03 =A0 =A0 =A0 =A0 6=0A>=0A>Thanks,=0A>Cri=
stian=0A>=0A
|
|
0
|
|
|
|
Reply
|
crisgugiu (90)
|
1/4/2010 9:45:42 PM
|
|
|
3 Replies
212 Views
(page loaded in 0.074 seconds)
|