Date: Thu, 11 Jun 2009 09:09:26 +0200
Reply-To: Anders Mørup Jensen <amo@SSI.DK>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Anders Mørup Jensen <amo@SSI.DK>
Organization: TDC Totalloesninger
Subject: Re: what function should I use to contain some specific characters
Hi Lily
In all your examples in dataset b you want to extract the part of type that
follows immediately after the string 'dr '.
Assuming that this is the general rule the statement
Type=substr(Type,index(Type,'dr ')+4);
should give you the desired value.
/ Anders
"Lily" <pointbreak3415@gmail.com> skrev i en meddelelse
news:d9ef828f-2232-4969-9d3a-b212616347cc@r33g2000yqn.googlegroups.com...
> Hey guys,
>
> I have two different datasets and wan to merge these two datasets.
> However, the key variable is a little different.
>
> For data set a, the variable "type" is like:
> CE 7-Passenger
> CE/LE
> Base
> Limited
> 7-Pass Ltd
>
> However, the variable 'type' in dataset b is like:
> FWD 4dr Limited
> 5dr 7-Pass Van LE Ltd FWD
> FWD 4dr L4 Base
> 5dr 7-Pass Van CE FWD
> 5dr 7-Pass Van LE FWD
>
> How can I make the variable 'type' in dataset b only keeps the
> characters which appears in b.type and get the following result:
> Limited
> 7-Pass LE Ltd
> Base
> 7-Pass CE
> 7-Pass LE
>
> Any help is appreciated. Thank you so much.
|