LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2008)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 30 Sep 2008 08:42:45 +0100
Reply-To:     Garry Gelade <garry@business-analytic.co.uk>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Garry Gelade <garry@business-analytic.co.uk>
Subject:      Re: widcards
Comments: To: Gary Stevens <garystevens@FLHSA.ORG>
In-Reply-To:  <200809292143.m8TIsL8m015831@malibu.cc.uga.edu>
Content-Type: text/plain; charset="us-ascii"

Gary,

From your syntax it looks like the variables are string variables, and the characters you want to select on are always in the leading positions. In that case you can use the SUBSTR function. In your syntax below try replacing the do line by

Do if ( SUBSTR(v1(#i),1,4) = '2344' | SUBSTR(v1(#i),1,4) = '3366' | SUBSTR(v1(#i),1,3) = '254' ).

Garry Gelade

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Gary Stevens Sent: 29 September 2008 22:43 To: SPSSX-L@LISTSERV.UGA.EDU Subject: widcards

How do I denote a wildcard in a five character wide field?

As an example, if * were a wildcard and I wrote 250** I would expect to select all data with 250 in the first three positions and anything else in the next two positions. Here's what I really want to do. I have 15 variables, xx1 to xx15, side by side. I want to find if 254** or 2344* or 3366* is found in any of variable columns 1-15.

A record line might have more than one scattered along the 15 columns or just one found in V15. I just want to know if it occurs in that record.

I will crosstab the findings.

Here's my attempt: The syntax below only finds the exact data i.e. '254' and not '254**'

vector v1=xx1 to xx15. loop #i=1 to 15. do if (any(v1(#i),'2344 ','254 ','3366 ')). compute positive=1. break. end if. end loop.

Many thanks, Gary

===================== 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 SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD

__________ NOD32 3481 (20080929) Information __________

This message was checked by NOD32 antivirus system. http://www.eset.com

===================== 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 SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD


Back to: Top of message | Previous page | Main SPSSX-L page