LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 1999)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 28 Jul 1999 19:55:17 -0400
Reply-To:     Raynald Levesque <rlevesque@VIDEOTRON.CA>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Raynald Levesque <rlevesque@VIDEOTRON.CA>
Subject:      Re: multiple records per case
Comments: To: aa3657@wayne.edu
Content-Type: text/plain; charset="iso-8859-1"

Hi Michael,

Suppose your variable which contains the case number is named var1. You thus sometimes have more than two records for the same value of var1.

The following syntax will select just one record (one line) for a given value of var1.

SORT CASES BY var1. DO IF $casenum=1. COMPUTE flag=1. ELSE IF var1=lag(var1). COMPUTE flag=0. ELSE. COMPUTE flag=1. END IF. EXECUTE. SELECT (flag=1).

If you want the record with the earliest date (say variable name is date1), replace the first line by SORT CASES BY var1 date1.

If you want the record with the latest date (say variable name is date1), replace the first line by SORT CASES BY var1 date1(D).

HTH

Raynald Levesque rlevesque@videotron.ca

----- Original Message ----- From: Michael Kruger <aa3657@WAYNE.EDU> Newsgroups: bit.listserv.spssx-l To: <SPSSX-L@LISTSERV.UGA.EDU> Sent: Wednesday, July 28, 1999 4:01 PM Subject: multiple records per case

> How do select a single record based on a date field when each case may > have 1 or 2 records per case? I want the final file to have only one > record per case? > > -- > > Michael Kruger "A True Prince" > Statistical Analyst > Wayne State Univ.School of Medicine > Dept. of OB/Gyn > (313)-577-1794


Back to: Top of message | Previous page | Main SPSSX-L page