Casestovars with 3 Variables as ID

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

Casestovars with 3 Variables as ID

Tom

Hello

 

Trying to transform a datafile with the command CASESTOVARS works fine, when I have just one variable to identify the cases.

 

MATCH FILES / FILE * / KEEP IDCourse Coursegroup course name familyname City.

SORT CASES BY familyname.

CASESTOVARS/ID=familyname.

 

In order to identify the unique cases – there are different people with the same familyname – I should compare familyname, name and city. These three variables alltogether are defining a unique case.

 

How can I do that ?

 

Thanks Tom

Reply | Threaded
Open this post in threaded view
|

Re: Casestovars with 3 Variables as ID

Melissa Ives

Tom,

Just use the three variables as the ID.

CASESTOVARS

 

[/ID = varlist]

 

 

 

SORT CASES BY familyname name city

CASESTOVARS/ID=familyname name city.

 

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Balmer, Thomas
Sent: Wednesday, February 15, 2012 6:39 AM
To: [hidden email]
Subject: [SPSSX-L] Casestovars with 3 Variables as ID

 

Hello

 

Trying to transform a datafile with the command CASESTOVARS works fine, when I have just one variable to identify the cases.

 

MATCH FILES / FILE * / KEEP IDCourse Coursegroup course name familyname City.

SORT CASES BY familyname.

CASESTOVARS/ID=familyname.

 

In order to identify the unique cases – there are different people with the same familyname – I should compare familyname, name and city. These three variables alltogether are defining a unique case.

 

How can I do that ?

 

Thanks Tom



PRIVILEGED AND CONFIDENTIAL INFORMATION
This transmittal and any attachments may contain PRIVILEGED AND
CONFIDENTIAL information and is intended only for the use of the
addressee. If you are not the designated recipient, or an employee
or agent authorized to deliver such transmittals to the designated
recipient, you are hereby notified that any dissemination,
copying or publication of this transmittal is strictly prohibited. If
you have received this transmittal in error, please notify us
immediately by replying to the sender and delete this copy from your
system. You may also call us at (309) 827-6026 for assistance.
Reply | Threaded
Open this post in threaded view
|

Re: Casestovars with 3 Variables as ID

David Marso
Administrator
In reply to this post by Tom
Build an ID which is based on the three variables. ;-)
--
SORT CASES BY familyname name city.
DO IF $CASENUM=1.
+  COMPUTE combID=1.
ELSE.
+  COMPUTE combID=LAG(combID).
+  IF familyname NE LAG(familyname)|name NE LAG(name)|city NE LAG(city) combID= combID+1.
END IF.
Then use combID as case Identifier in CASESTOVARS .
I will leave that part to you.


Balmer Thomas wrote
Hello

Trying to transform a datafile with the command CASESTOVARS works fine, when I have just one variable to identify the cases.

MATCH FILES / FILE * / KEEP IDCourse Coursegroup course name familyname City.
SORT CASES BY familyname.
CASESTOVARS/ID=familyname.

In order to identify the unique cases - there are different people with the same familyname - I should compare familyname, name and city. These three variables alltogether are defining a unique case.

How can I do that ?

Thanks Tom
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Casestovars with 3 Variables as ID

David Marso
Administrator
In reply to this post by Melissa Ives
Ah, silly me! ;-)
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"