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 (July 2007)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 12 Jul 2007 15:53:27 -0500
Reply-To:     "Hashmi, Syed S" <Syed.S.Hashmi.1@uth.tmc.edu>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         "Hashmi, Syed S" <Syed.S.Hashmi.1@uth.tmc.edu>
Subject:      Re: Wild cards
In-Reply-To:  <820E5CA81E7A2544A9D7E0A25025E481FFFB8B@e2k0305.chestnut.net>
Content-Type: text/plain; charset="iso-8859-1"

Thanks Melissa,

I got the following error when I tried running your syntax: An undefined variable name, or a scratch or system variable was specified in a variable list which accepts only standard variables. Check spelling and verify the existence of this variable.¬This command not executed.¬

However, I broke it up into two separate commands and can use the final variable in the DO IF statements:

COMPUTE MODstep = MOD(code1, 1). COMPUTE TRUNCstep = TRUNC(MODstep*10). DO IF TRUNCstep = 1.

It works great! Thanks again.

Shahrukh

> -----Original Message----- > From: Melissa Ives [mailto:mives@chestnut.org] > Sent: Thursday, July 12, 2007 3:02 PM > To: Hashmi, Syed S; SPSSX-L@LISTSERV.UGA.EDU > Subject: RE: [SPSSX-L] Wild cards > > Look into a calculation using a combination of MOD and TRUNC > > MOD. MOD(numexpr,modulus). Numeric. Returns the remainder when numexpr > is divided by modulus. Both arguments must be numeric, and modulus must > not be 0. > > TRUNC. TRUNC(numexpr). Numeric. Returns the value of numexpr truncated > to an integer (toward 0). > > Something like this (totally untested)--where you want to divide code1 > by 1 to keep only the portion following the decimal, then multiply by 10 > and truncate the result so you get just the 1 in your 2.13/5.18 example > below. > > Do if (trunc((mod(code1,1)/10)). > > Melissa > > -----Original Message----- > From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of > Hashmi, Syed S > Sent: Thursday, July 12, 2007 2:53 PM > To: SPSSX-L@LISTSERV.UGA.EDU > Subject: [SPSSX-L] Wild cards > > Hello everyone, > > I have some data where the cases have numerical codes assigned to them > in a variable called "code1" the format #.## and range from 1.10 to 9.79 > (though it does not include every single number in that range). Each of > the three characters in that code stands for some common characteristic, > eg. 1.10 is similar to 1.20 or 1.34 (all are in 1.## format). > Similarly, 1.10 shares some characteristics with 2.13 or 5.18 (all are > in #.1# format). > > I wanted to make some computations based on the values of these codes. > It's easy when I wanted to do the computations for all cases with > code1=2.** or code=3.2* since it involved a simple DO IF statement: > DO IF (code1 GE 1.00 & code1 LE 1.99). > > My issue arises when I want to do computations on cases where the codes > are similar at the second character, eg. all cases with a #.2# code. > Does SPSS (I'm on v.15) have any wild card characters that I could use > for doing this?? If not, can I use the INDEX subcommand to specify the > character instead? > > I would appreciate any help that anyone might be able to provide. Thanks > a heap in advance. > > - Shahrukh Hashmi > > > PRIVILEGED AND CONFIDENTIAL INFORMATION > This transmittal and any attachments may contain PRIVILEGED AND > CONFIDENTIAL information and is intended only for the use of the > addressee. If you are not the designated recipient, or an employee > or agent authorized to deliver such transmittals to the designated > recipient, you are hereby notified that any dissemination, > copying or publication of this transmittal is strictly prohibited. If > you have received this transmittal in error, please notify us > immediately by replying to the sender and delete this copy from your > system. You may also call us at (309) 827-6026 for assistance.


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