Identifying first and last cases

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

Identifying first and last cases

trece por ciento
I´m trying to identify the first and last cases of a sav file with:

match files file=* /last=fin.
do if fin.
compute ...
end if.

And I get the error:

Error # 5124 : A FIRST or LAST subcommand is specified without a BY
subcommand.  A BY subcommand is required with a FIRST or LAST subcommand.

Sorry, but I don't catch the error.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Identifying first and last cases

Melissa Ives
I've never done this, but it is saying that you need to add a /BY=varname to your Match file command--otherwise SPSS won't know which 'last' you want to identify.
Try something like: (the /by command may need to go before /last??)

match files file=* /last=fin /by=myvar.
do if fin.
compute ...
end if.

Melissa

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of el13porciento
Sent: Thursday, October 18, 2007 10:10 AM
To: [hidden email]
Subject: [SPSSX-L] Identifying first and last cases

I´m trying to identify the first and last cases of a sav file with:

match files file=* /last=fin.
do if fin.
compute ...
end if.

And I get the error:

Error # 5124 : A FIRST or LAST subcommand is specified without a BY subcommand.  A BY subcommand is required with a FIRST or LAST subcommand.

Sorry, but I don't catch the error.

=====================
To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD


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.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Identifying first and last cases

Richard Ristow
In reply to this post by trece por ciento
At 11:09 AM 10/18/2007, el13porciento wrote:

>I'm trying to identify the first and last cases of a sav file with:
>
>match files file=* /last=fin.
>do if fin.
>compute ...
>end if.
>
>And I get the error:
>
>>Error # 5124 : A FIRST or LAST subcommand is specified without a BY
>>subcommand.  A BY subcommand is required with a FIRST or LAST
>>subcommand.

Melissa's quite right: "you need to add a /BY=varname to your Match
file command--otherwise SPSS won't know which 'last' you want to
identify."

To identify the first and last cases in the file altogether, the
following somewhat kludgy solution is standard:

COMPUTE NOBREAK = 1.
match files file=* /BY NOBREAK/last=fin.

You can identify the first case in the file by

IF $CASENUM EQ 1 ...

but there's no built-in for the last case, as such. Sigh.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD