Date: Thu, 3 Aug 2006 02:59:37 -0400
Reply-To: Eric Hoogenboom <erichoogenboom@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Eric Hoogenboom <erichoogenboom@YAHOO.COM>
Subject: Re: How to extract letter?
Yufei,
Try this code. It works fine for your given examples.
data complot;
length code $ 20;
code = "12:55:01 MD PD C1"; output;
code = "12:55:01 MDPD C1"; output;
run;
data split (drop=locateplot);
set complot;
length time 8 plot $ 3 doctor $ 2 patient $ 2 locateplot $ 8;
format time time8.;
time = input(substr(code, 1, 8), time8.);
patient = substr(code, length(code)-1, 2);
doctor = substr(code, length(code)-4, 2);
locateplot = substr(code, 10, length(code)-12);
plot = substr(locateplot, 1, length(locateplot)-2);
put code= time= plot= doctor= patient=;
run;
Hth,
Eric
|