Date: Mon, 19 Aug 2002 13:21:08 -0500
Reply-To: "Marks, Jim" <jim.marks@lodgenet.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Marks, Jim" <jim.marks@lodgenet.com>
Subject: Re: merging / recoding string?
Content-Type: text/plain
Hi Sabina and List:
You can use CONCAT to merge two strings. Here is syntax that does the job:
** sample data.
DATA LIST FREE (",") /var001 (a20) var002 (a20).
BEGIN DATA
fname,,
,lname,
,,
jim,,
,marks,
END DATA.
** create new string variable.
STRING name (a20).
COMP name= CONCAT(rtrim(var001),RTRIM(var002)).
EXE.
HTH
Jim Marks
Market Analyst
LodgeNet Entertainment Corporation
605.988.1616
IMPORTANT NOTICE: This communication (including any attached files) is
intended for the entity to which it is directed and may contain confidential
and proprietary information of LodgeNet Entertainment Corporation. The
communication is provided under the terms of the nondisclosure agreement
between LodgeNet and the intended recipient. If you are not acting solely
on behalf of the intended recipient with respect to the receipt of this
communication, you are not authorized to receive, retain, print or forward
this communication. In that event, you are directed to destroy this
communication (including any attached files), and to advise
ipmanager@lodgenet.com that you received this communication in error. If
you are authorized to receive this communication on behalf of the intended
recipient, you are obligated to treat it as confidential and proprietary
information of LodgeNet Entertainment Corporation, in accordance with the
nondisclosure agreement mentioned above.
-----Original Message-----
From: Sabina Schnelle [mailto:Sabina@work.asn.au]
Sent: Monday, August 19, 2002 11:06 AM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: merging / recoding string?
Hello.
Is there a simple way to merge two variables into one if both their
format is string?
Only one of var001 or var002 has a value; at any case the other is empty
(i.e. string equivalent to SYSMIS); some cases are empty for both
variables.
Enclosed is the syntax that works for the analogue numeric problem:
RECODE
var001 (SYSMIS=96) (99=99) (97=97) (0=0) (1=1) (2=2) (3=3) (4=4) .
EXECUTE .
RECODE
var 002 (SYSMIS=96) (99=99) (97=97) (0=0) (1=1) (2=2) (3=3) (4=4) .
EXECUTE .
COMPUTE var1new = var001 + var002 - 96 .
EXECUTE .
Any help greatly appreciated.
Thanks in advance,
Sabina