Date: Fri, 11 Jan 2008 11:34:47 -0500
Reply-To: Catherine Kubitschek <Catherine.A.Kubitschek.email@example.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Catherine Kubitschek <Catherine.A.Kubitschek.firstname.lastname@example.org>
Subject: Re: select cases from part of idnum variable
Content-Type: text/plain; charset="us-ascii"; format=flowed
Martin, thanks for the information.
You've gotten a couple of good answers already. Art Kendall's solution
works because your data is a standard format & width.
At 1/11/2008 08:49 AM, Art Kendall wrote:
>compute newidnum= trunc (idnum/10000).
>recode newidnum(101 thru 105, 107, 114, 117,118=1)(else=0) into mygroup.
>select if mygroup eq 1).
>filter by mygroup.
John Norton's solution would work regardless of exactly what your data
At 1/10/2008 05:49 PM, Norton, John wrote:
>Hi Dr. Sherman,
>I think one way to approach this is to treat the source as a string
>variable, and then convert the extracted values back to numbers within the
>ANY() function. The following example takes this approach, and therefore
>allows me to use several string functions, evaluate for the selection
>criteria, and then create a binary flag variable on which I can filter or
>execute a SELECT IF command.
>COMPUTE flag =
At 1/10/2008 08:44 PM, Martin Sherman wrote:
>Catherine: The format is F7.0. The lowest values are below and
>1181319 Here is the highest value. My concern is only with the first
>At 1/10/2008 04:47 PM, Martin Sherman wrote:
> >Dear list: I have a large data set with a variable called IDNUM which has
> >8 digits. I want to select those cases that start with 101, 102, 103,
> >104, 105, 107, 114, 117, or 118. I don't care what numbers come after the
> >first three. I check Raynald Levesque's site and could not find a syntax
> >program for selecting cases based on the first three values of a numerical
> >variable. Suggestions appreciated. thanks,
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
For a list of commands to manage subscriptions, send the command