Date: Tue, 19 Apr 2011 07:05:18 -0400
Reply-To: Nat Wooding <nathani@VERIZON.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Nat Wooding <nathani@VERIZON.NET>
Subject: Re: Extracting multiple value from a variable
In-Reply-To: <201104182223.p3IJPlZS009965@waikiki.cc.uga.edu>
Content-Type: text/plain; charset="US-ASCII"
Vivian
Upon some further thought, here is a simpler solution than the one that I
offered last night.
Nat Wooding
********* method 2;
%let num = 4;* this will be the number of Vars in the output data set;
options symbolgen;
Data test2;
length char var1 - var&num $ 16;
array able var: ;
drop char;
do _i_ = 1 to dim(able);
input char @;
if '12/31/9999' lt char lt 'a' then able(_i_) = char;
else _i_ = _i_ - 1;
end;
datalines;
1234567899874555 correction of 9879879879879879 prev correction of
1234567890123123 01/01/2010 reverse 3216549870321654
2234567899874555 correction of 9879879879879879 prev correction of
1234567890123123 12/31/2010 reverse 3216549870321654
;
run;
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Vivian
Barber
Sent: Monday, April 18, 2011 6:23 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Extracting multiple value from a variable
Hi All,
I'm trying to extract multiple values from a text field. I need to output
each 16 character value to a separate variable.
The field is character length 2,000. The data that I'm reading has
100,000 plus rows.
The expect output of data=test (below) would be.
var1=1234567899874555
var2=9879879879879879
var3=1234567890123123
var4=3216549870321654
Data test;
input note $2000.;
datalines;
1234567899874555 correction of 9879879879879879 prev correction of
1234567890123123 12/15/2010 reverse 3216549870321654
;
run;
Your help is most appreciated!
Vivian