Date: Mon, 29 Dec 2008 08:47:17 -0500
Reply-To: Clive Downs <clive.downs@READING.GOV.UK>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Clive Downs <clive.downs@READING.GOV.UK>
Subject: Re: Creating new variables from a string variable
Content-Type: text/plain; charset=ISO-8859-1
Hi
The following syntax should do this, if I have understood your question
correctly.
* bigstring is the original 1000 char string variable.
*---------------------------------------.
STRING unpack1 unpack2 unpack3 unpack4 (A250).
COMPUTE unpack1 = SUBSTR(bigstring,1,250) .
COMPUTE unpack2 = SUBSTR(bigstring,251,500) .
COMPUTE unpack3 = SUBSTR(bigstring,501,750) .
COMPUTE unpack4 = SUBSTR(bigstring,751,1000) .
EXECUTE .
Regards
Clive
On Mon, 29 Dec 2008 12:36:56 -0000, Pettitt-Morris Caroline
<caroline.pettitt-morris@bedfordshire.pnn.police.uk> wrote:
>Hello.
>
>I am having some trouble with a piece of syntax that I can’t work out.
>
>I have a string variable that is 1000 characters long (all in use).
>I need to put this info into excel for other officers who do not use SPSS
to view.
>Excel has a limit of 255 characters per cell.
>
>How do I split this variable into 4 new variables with 250 characters in
each?
>
>Along the lines of...
>
>Text Variable (1 – 250) = Text1
>Text Variable (251 – 500) = Text2
>Text Variable (501 – 750) = Text3
>Text Variable (751 -1000) = Text 4
>EXECUTE.
>
>But I need it to work!!!
>
>Have tried using Visual Binning (numeric only) and the recode dialogues
but am stuck.
>
>Could you offer any advice or help please?
>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
    >Caroline PETTITT-MORRIS
>Intelligence Analyst
>Greyfriars Police Station
>Greyfriars
>Bedford
>MK40 1HR
=====================
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
|