Date: Mon, 19 Aug 2002 13:21:08 -0500
Reply-To: "Marks, Jim" <email@example.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Marks, Jim" <firstname.lastname@example.org>
Subject: Re: merging / recoding string?
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).
** create new string variable.
STRING name (a20).
COMP name= CONCAT(rtrim(var001),RTRIM(var002)).
LodgeNet Entertainment Corporation
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
email@example.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.
From: Sabina Schnelle [mailto:Sabina@work.asn.au]
Sent: Monday, August 19, 2002 11:06 AM
Subject: merging / recoding string?
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
Enclosed is the syntax that works for the analogue numeric problem:
var001 (SYSMIS=96) (99=99) (97=97) (0=0) (1=1) (2=2) (3=3) (4=4) .
var 002 (SYSMIS=96) (99=99) (97=97) (0=0) (1=1) (2=2) (3=3) (4=4) .
COMPUTE var1new = var001 + var002 - 96 .
Any help greatly appreciated.
Thanks in advance,