Cases to Vars where number of cases differ.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Cases to Vars where number of cases differ.

Mark Webb-3
I have data that I want to convert with cases to vars but the number of cases differ.
The data is described below -
Note-Not all questions answered by all doctors.

Doctor Hospital Question Response
1           A             1              Yes
1           A             2               No
1           A             4               Yes
2           A             2               Yes
2           A             4                No
3
etc.

I want -

Doctor Hospital Q1  Q2  Q3  Q4
1           A            Yes No          Yes
2           A                   Yes         No
3
etc.

Any pointers ?
Thanks in advance.
Mark Webb
Cape Town.
Reply | Threaded
Open this post in threaded view
|

Re: Cases to Vars where number of cases differ.

Winson Yeung
Hi Mark,

Please try this syntax:

SORT CASES BY Doctor Question .
CASESTOVARS
 /ID = Doctor
 /INDEX = Question
 /GROUPBY = VARIABLE
 /VIND.

Thanks & Regards,
Winson


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]]On Behalf Of Mark Webb
Sent: Friday, October 27, 2006 1:49 PM
To: [hidden email]
Subject: Cases to Vars where number of cases differ.


I have data that I want to convert with cases to vars but the number of cases differ.
The data is described below -
Note-Not all questions answered by all doctors.

Doctor Hospital Question Response
1           A             1              Yes
1           A             2               No
1           A             4               Yes
2           A             2               Yes
2           A             4                No
3
etc.

I want -

Doctor Hospital Q1  Q2  Q3  Q4
1           A            Yes No          Yes
2           A                   Yes         No
3
etc.

Any pointers ?
Thanks in advance.
Mark Webb
Cape Town.