Date: Thu, 3 Aug 2006 13:09:05 +0800
Reply-To: Yufei Wang <yufeiw@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Yufei Wang <yufeiw@GMAIL.COM>
Subject: How to extract letter?
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Sorry to bother you.
A dataset using "code" as the ID for each observation. Unfortunately, the
"code" was composed of "time plot Doctor patient".
My job is to split it to "time"+"plot"+"Doctor"+"patient".
Although "doctor" and "patient" are all composed of exactly two letters or
numbers, the "code" has different length because:
1. The "plot" used both letter and number to be identified, and some plots
numbered larger than 9 .
For instance. "MD" or "M6", "M10";
2. Regularly, the "code" have blank between each field when they were
recorded, however, some don't have blank between "plot" and "Doctor".
For instance, "12:55:01 MD PD C1", or "12:55:01 MDPD C1".
I'm a biginner for SAS and programming, because of two above-mentioned
reason, I can't use neither the length nor delimiter to extract the
characters of each field.
Can anybody help me or give me hint to solve this problem?
Thanks in advance
Yufei Wang
|