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 12:37:33 -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:      RTRIM mistake
Content-Type: text/plain; charset="iso-8859-1"

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


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