Extracting Individual Cases From Variables?

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

Extracting Individual Cases From Variables?

Dan-155
Hello,
Say I have a variable, 'lastname'.
I'd like to know the last name of the 8th person on my list of cases.
How would I go about this?

(My problem is somewhat more complicated than this but this seemed like
the easiest method of explaining it)
Reply | Threaded
Open this post in threaded view
|

Re: Extracting Individual Cases From Variables?

Richard Ristow
At 03:39 PM 4/13/2007, Dan wrote:

>Say I have a variable, 'lastname'. I'd like to know the last name of
>the 8th person on my list of cases.
>
>(My problem is somewhat more complicated than this but this seemed
>like the easiest method of explaining it)

The following (SPSS 15 draft output; not saved separately) is a syntax
solution. It does what you asked for, in a very basic way. It would
also be easy to save the 8th value in an SPSS file, or in the working
file. Is this anything like what you were looking for?

|-----------------------------|---------------------------|
|Output Created               |13-APR-2007 20:56:39       |
|-----------------------------|---------------------------|
Greek

Alpha
Beta
Gamma
Delta
Epsilon
Zeta
Eta
Theta
Iota
Kappa
Lambda
Mu
Nu
Xi
Omikron
Pi
Rho
Sigma
Tau
Upsilon
Phi
Chi
Psi
Omega

Number of cases read:  24    Number of cases listed:  24


TEMPORARY.
SELECT IF $CASENUM EQ 8.
LIST.

List
|-----------------------------|---------------------------|
|Output Created               |13-APR-2007 20:56:39       |
|-----------------------------|---------------------------|
Greek

Theta

Number of cases read:  1    Number of cases listed:  1


===================
APPENDIX: Test data
===================
*  The most standard test data:  the Greek alphabet  .
DATA LIST FIXED
    /Greek   04-11 (A).
BEGIN DATA
1  Alpha
2  Beta
3  Gamma
4  Delta
5  Epsilon
6  Zeta
7  Eta
8  Theta
9  Iota
10 Kappa
11 Lambda
12 Mu
13 Nu
14 Xi
15 Omikron
16 Pi
17 Rho
18 Sigma
19 Tau
20 Upsilon
21 Phi
22 Chi
23 Psi
24 Omega
END DATA.

LIST.