LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (June 1999)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 23 Jun 1999 15:11:30 +0200
Reply-To:     "m.feldkircher@ogilvyone.de" <m.feldkircher@ogilvyone.de>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Martin Feldkircher <m.feldkircher@OGILVYONE.DE>
Organization: OgilvyOne
Subject:      AW: Selecting first 2 digits from a string variable
Comments: cc: "jcreech@VCSC.STATE.VA.US" <jcreech@VCSC.STATE.VA.US>
Content-Type: text/plain; charset="iso-8859-1"

> -----Ursprüngliche Nachricht----- > Von: James C. Creech [SMTP:jcreech@VCSC.STATE.VA.US] > Gesendet am: Mittwoch, 23. Juni 1999 01:13 > An: SPSSX-L@LISTSERV.UGA.EDU > Betreff: Re: Selecting first 2 digits from a string variable > > string newvar (a2). > compute newvar=oldvar. > recode newvar (convert) into newvar2. > > The first two lines create a 2 byte varaiable and copies the > first two bytes of the old variable. The third line converts > the new string variable into the desired numeric. >

IMHO, an easier way is the following command.

compute newvar = NUMBER(SUBSTR(oldvar,1,2),F2.0).

mf


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