Re : creating new variable

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re : creating new variable

Ekoué KOUEVIDJIN
Hello Abbas.
Try this syntax, OldVar and NewVar being respectively the old and new variable.

COMPUTE Howlong = LENGTH(RTRIM(var01)).
EXE.
STRING var02 (a7).
COMPUTE var02 = var01.
EXE.
IF (Howlong = 6) var02 = CONCAT(substr(var01,1,3),' ', SUBSTR(var01,4,3)).
exe.
DELETE VARIABLE Howlong .

Sincerely.
 
Ekoué KOUEVIDJIN
Ingénieur Statisticien
Technicien Supérieur en Electronique



----- Message d'origine ----
De : "Abbas, Zahid RQHR" <[hidden email]>
À : [hidden email]
Envoyé le : Mercredi, 28 Novembre 2007, 15h02mn 47s
Objet : Re: creating new variable

Hi Jim,
I get the following error message

>Error # 4381 in column 70.  Text: .
>The expression ends unexpectedly.
>This command not executed.

Zahid


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Marks, Jim
Sent: November 27, 2007 2:27 PM
To: [hidden email]
Subject: Re: FW: creating new variable

data list list /oldPcode (a7).
begin data
'S0G 3X0'
'S3N2K7'
'S0A 1S0'
'S0A 3C0'
'S0A 3C0'
'S0A4T0'
END DATA.

STRING newPcode (a7).
COMPUTE newPcode = oldPcode.
IF substr(oldPcode,4,1) NE ' '
  newPcode = CONCAT(substr(oldPcode,1,3),' ', SUBSTR(oldPcode,4,3) ).
exe.

-- jim

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Abbas, Zahid RQHR
Sent: Tuesday, November 27, 2007 2:00 PM
To: [hidden email]
Subject: FW: creating new variable

-----Original Message-----
From: ViAnn Beadle [mailto:[hidden email]]
Sent: November 27, 2007 1:56 PM
To: Abbas, Zahid RQHR
Subject: RE: creating new variable

Forward your response to the list--you'll get a variety of different
solutions. Is this one variable read as a string?

-----Original Message-----
From: Abbas, Zahid RQHR [mailto:[hidden email]]
Sent: Tuesday, November 27, 2007 12:55 PM
To: ViAnn Beadle
Subject: RE: creating new variable

Here is how many data looks.

S0G 3X0
S3N2K7
S0A 1S0
S0A 3C0
S0A 3C0
S0A4T0

I want that all of the data looks like

S0G 3X0
S3N 2K7
S0A 1S0
S0A 3C0
S0A 3C0
S0A 4T0

Thanks, Zahid



-----Original Message-----
From: ViAnn Beadle [mailto:[hidden email]]
Sent: November 27, 2007 1:50 PM
To: Abbas, Zahid RQHR; [hidden email]
Subject: RE: creating new variable

What do you mean when you save X0X 1X1 format? Can you give us an
example of what your data look and what you what them to become.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Abbas, Zahid RQHR
Sent: Tuesday, November 27, 2007 12:43 PM
To: [hidden email]
Subject: creating new variable

Hello all,



I will appreciate any help with the following:



I have a variable where some of the values are in X0X 1X1 and the others
in XOX1X1 format. I want to create a new variable where all values are
in X0X 1X1 format.



Thanks, Zahid

=======
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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
[hidden email] (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
[hidden email] (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
[hidden email] (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


      _____________________________________________________________________________
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail

====================To manage your subscription to SPSSX-L, send a message to
[hidden email] (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