=========================================================================
Date: Fri, 19 Jul 2002 10:42:44 -0400
Reply-To: Floyd.G.Nevseta@BANKOFAMERICA.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Floyd Nevseta <Floyd.G.Nevseta@BANKOFAMERICA.COM>
Subject: Re: combine two variables
Content-type: text/plain; charset=us-ascii
Try this:
data new;
set original;
drop i;
array var(3);
do i = 2 to 3;
if not missing(var(i)) then
do;
newvar = var(i);
output;
end;
end;
run;
Floyd
Asheber Sewalem <sewalem@CDN.CA> on 07/19/2002 09:51:57 AM
Please respond to Asheber Sewalem <sewalem@CDN.CA>
To: SAS-L@LISTSERV.UGA.EDU
cc:
Subject: combine two variables
Hi does anyone know how to combine two variables into one
I have the following data set
id var1 var2 var3
168 19911003 31121991 .
168 19930428 30061993 .
168 19940620 . 30061994
168 19950520 30061995 .
168 19971128 31121997 30061998
168 19981001 31121998 30061999
I want combine var2 and var3 variables and create a new varaible
(newvar). The following is the desired output.
id var1 newvar
168 19911003 31121991
168 19930428 30061993
168 19940620 30061994
168 19950520 30061995
168 19971128 31121997
168 19971128 30061998
168 19981001 31121998
168 19981001 30061999
Is it possible to do it in SAS?