DO IF, Selection on a Range of Values

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

SeeTre2
Posts: 2
Joined: Wed Oct 24, 2012 1:52 pm

DO IF, Selection on a Range of Values

Postby SeeTre2 » Fri Jan 09, 2015 4:23 pm

Hi,

I am trying to separate my data set into class strata using values of two variables: ShrUnitID and TimeIncrmnt. Specifically, I am trying to program SPSS to perform a recode of TimeIncrmnt on records to create a new variable (Class) if the values of ShrUnitID are within particular ranges. However, I cannot figure out how to write the code to recode for my middle ranges:
Range 1: 1 to 18 [successful]
Range 2: 20 to 25 (inclusive) & 36 to 38 (inclusive) [unsuccessful]
Range 3: 26 to 35 [inclusive]

I am able to get the first range recoded using the following:

DO IF (ShrUnitID <= 18).
RECODE TimeIncrmnt (CONVERT) ('0600 to 0900'=1) ('0900 to 1200'=1) ('1200 to 1500'=2) ('1500 to 1800'=3) ('1800 to 2100'=3) INTO CLASS.
END IF.
EXECUTE.

However, I cannot figure out ask SPSS to use a range between two values. I've tried many different commands and configures, but to no avail. Does anyone know how to do this? Effectively, in plain language, this is what I'd like to do: DO IF the value of ShrUnitID is 26 or 35, or falls between the range of 26 to 35.

Thanks!
Theresa
GerineL
Moderator
Posts: 1477
Joined: Tue Jun 10, 2008 4:50 pm

Re: DO IF, Selection on a Range of Values

Postby GerineL » Mon Jan 12, 2015 10:34 am

combine > with <

e.g.

if (ball >= 20 & Ball <30).

Who is online

Users browsing this forum: No registered users and 2 guests

cron