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 (February 2008)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 12 Feb 2008 15:35:42 -0000
Reply-To:     Muir Houston <muir.houston@stir.ac.uk>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Muir Houston <muir.houston@stir.ac.uk>
Subject:      Re: RTRIM mistake
Comments: To: "Oliver, Richard" <roliver@spss.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi Richard and listers I tried Anton's suggestion COMPUTE P_code=RTRIM(SUBSTR(Postcode,1, INDEX(Postcode,' ')+1)).

and it generated this error code >Error # 4309 in column 256. Text: (End of Command)

>Invalid combination of data types in an assignment. Character strings may

>only be assigned to string variables. Numeric and logical quantities may

>only be assigned to numeric variables. Consider using the STRING or NUMBER

>function.

>This command not executed.

so till not sure - yes I want one digit after the blank

thanks

Muir

Muir Houston Research Fellow CRLL Institute of Education University of Stirling FK9 4LA 01786-46-7615

________________________________

From: SPSSX(r) Discussion on behalf of Oliver, Richard Sent: Tue 12/02/2008 15:27 To: SPSSX-L@LISTSERV.UGA.EDU Subject: Re: RTRIM mistake

Oops. Never mind. +1 is correct if the goal is capture everything up to the space and including the next character after the space.

-----Original Message----- From: Oliver, Richard Sent: Tuesday, February 12, 2008 9:05 AM To: 'a.smulders@beke.nl'; SPSSX-L@LISTSERV.UGA.EDU Subject: RE: Re: RTRIM mistake

Still almost right, but I think the +1 should be -1, since I think the goal is to get everything up to, but not including the blank space.

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Antoon Smulders Sent: Tuesday, February 12, 2008 7:46 AM To: SPSSX-L@LISTSERV.UGA.EDU Subject: Re: RTRIM mistake

Hello Muir,

Almost right, change your compute into:

COMPUTE P_code=RTRIM(SUBSTR(Postcode,1, INDEX(Postcode,' ')+1)).

To start at the first character up to the character after the space.

Antoon

-----Oorspronkelijk bericht----- Van: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] Namens Muir Houston Verzonden: dinsdag 12 februari 2008 13:38 Aan: SPSSX-L@LISTSERV.UGA.EDU Onderwerp: RTRIM mistake

Hi all, I have a simple problem but have done something wrong

I have a variable 'Postcode' which contains area information similar to a Zip code I think - I want to match cases to a data file which assigns postcodes to a deprivation index

the variable 'Postcode' is a string and is in the form 'AB12 38G' - although it can also have a single digit before the space - 'DD4 8JH'

what I am trying to do - is to trim the variable so that I have a new variable 'P_code' which in the case of the two examples provided would result in: 'AB12 3' and 'DD4 8'

I tried this based on something on Raynald's site:

***************************************** STRING P_code (A6).

COMPUTE P_code=RTRIM(SUBSTR(Postcode,INDEX(Postcode,' ')+1)).

EXECUTE.

which I thought would result in what I desired - however, what it actually delivered for the value 'AB12 38G' was '38G'

what bit of syntax is wrong?

I did search the archives and found some code by Jon Peck from July 2007 but it involved Python and I have no knowledge and am a bit of a syntax newbie

Muir Houston Research Fellow CRLL Institute of Education University of Stirling FK9 4LA 01786-46-7615

-- The University of Stirling is a university established in Scotland by charter at Stirling, FK9 4LA. Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not disclose, copy or deliver this message to anyone and any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. In such case, you should destroy this message and kindly notify the sender by reply email. Please advise immediately if you or your employer do not consent to Internet email for messages of this kind.

======= 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

===================== 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

===================== 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

-- The University of Stirling is a university established in Scotland by charter at Stirling, FK9 4LA. Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not disclose, copy or deliver this message to anyone and any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. In such case, you should destroy this message and kindly notify the sender by reply email. Please advise immediately if you or your employer do not consent to Internet email for messages of this kind.

====================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