| Date: | Tue, 26 Jul 2011 10:48:34 +0200 |
| Reply-To: | John F Hall <johnfhall@orange.fr> |
| Sender: | "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU> |
| From: | John F Hall <johnfhall@orange.fr> |
| Subject: | Re: help with selecting records |
|
| In-Reply-To: | <OF76EA3680.7826484A-ONCA2578D9.002131F6-CA2578D9.0021C9A9@police.nsw.gov.au> |
| Content-Type: | multipart/alternative;
|
|---|
Is this how your data are stored? If so you will be dealing with strings.
It's easier to work with numeric data, so I would recode the strings.
Probably best to create a new variable NEWTYPE first with something like:
File > new > syntax, then write:
DO IF (INVOLVEMENTTYPE = 'VICTIM' )
NEWTYPE = 1)
ELSE IF (INVOLVEMENTTYPE = PERSON OF INTEREST)
NEWTYPE = 2
ELSE IF (INVOLVEMENTTYPE = 'VICTIM' ) AND (INVOLVEMENTTYPE = PERSON OF
INTEREST)
NEWTYPE = 3
END IF.
You can then use SELECT IF, but unless you precede it with a TEMPORARY
command, you will lose the unselected cases if you save the file. Thus:
TEMP .
SELECT IF (NEWVAR EQ 1) .
<ANALYSIS 1> .
TEMP .
SELECT IF (NEWVAR EQ 2) .
<ANALYSIS 2> .
TEMP .
SELECT IF (NEWVAR EQ 3) .
<ANALYSIS 3> .
I always work in lower case with abbreviated syntax. There is relevant
tutorial
<http://surveyresearch.weebly.com/uploads/2/9/9/8/2998485/2.3.1.1__data_tran
sformations.doc> 2.3.1.1 Data transformations on my website under:
2.3: Data transformations
Selecting variables for analysis, changing the names of variables, changing
the values of variables. Creating new variables from existing ones.
Selecting cases for analysis as a transition from analysing one variable to
analysing two or more variables.
John F Hall
<mailto:johnfhall@orange.fr> johnfhall@orange.fr
<http://surveyresearch.weebly.com/> www.surveyresearch.weebly.com
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of
Thara Vardhan
Sent: 26 July 2011 08:09
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: help with selecting records
Dear list members
I have a data file which with variables personcni and Involvement Type and
the file is structured as follows:
Sample dummy data:
PersonCNI InvolvementType
123 VICTIM
330 VICTIM
330 PERSON OF INTEREST
330 PERSON OF INTEREST
451 PERSON OF INTEREST
555 PERSON OF INTEREST
555 PERSON OF INTEREST
666 PERSON OF INTEREST
777 PERSON OF INTEREST
777 PERSON OF INTEREST
888 PERSON OF INTEREST
888 VICTIM
888 VICTIM
888 VICTIM
888 VICTIM
888 VICTIM
9999 VICTIM
9999 VICTIM
9999 PERSON OF INTEREST
9999 VICTIM
How do I select records where the person is a
a) victim only
b) POI only
c) Both a victim and poi
In the first instance i am keeping it very simple with just these two
variables without taking into account any date variables. All involvements
were over 1 year period.
I would be grateful if somebody could help select these records.
many thanks regards
thara
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _
The information contained in this email is intended for the named
recipient(s)
only. It may contain private, confidential, copyright or legally privileged
information. If you are not the intended recipient or you have received this
email by mistake, please reply to the author and delete this email
immediately.
You must not copy, print, forward or distribute this email, nor place
reliance
on its contents. This email and any attachment have been virus scanned.
However,
you are requested to conduct a virus scan as well. No liability is accepted
for any loss or damage resulting from a computer virus, or resulting from a
delay
or defect in transmission of this email or any attached file. This email
does not
constitute a representation by the NSW Police Force unless the author is
legally
entitled to do so.
[text/html]
|