Date: Wed, 12 Nov 2008 11:11:43 -0500
Reply-To: joey m <sasuser.joey.m@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: joey m <sasuser.joey.m@GMAIL.COM>
Subject: Re: modifying a variable
In-Reply-To: <705bcd670811120809lf92ce1eua36a88f943434f0@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Sorry Joe, I meant Joe : )
On Wed, Nov 12, 2008 at 11:09 AM, joey m <sasuser.joey.m@gmail.com> wrote:
> Jose, thank you very much.
> **
> *data* test2; set test;
> id=compress(id,'A');
> *run*;
>
> worked very well.
>
> What if the letter takes any value (a,b, c, etc)? Is there a way to make it
> more general?
>
> Cheers.
>
> J
>
> On Wed, Nov 12, 2008 at 10:55 AM, Joe Matise <snoopy369@gmail.com>wrote:
>
>> var2 = substr(var1,1,4) would do it... if it's more complex than that, you
>> can use notdigit() or anyalpha() to find the location of non-numeric
>> characters and then strip them off. Or you could use compress(var1,'A') to
>> remove the letter A .
>>
>> -Joe
>>
>>
>> On Wed, Nov 12, 2008 at 9:47 AM, joey m <sasuser.joey.m@gmail.com> wrote:
>>
>>> Hi All:
>>>
>>> How can I go from something like this:
>>>
>>> 5501A
>>> 5402A
>>> 5803A
>>>
>>> to something like this?:
>>>
>>> 5501
>>> 5402
>>> 5803
>>>
>>> As always, thanks a lot for your help.
>>>
>>> J
>>>
>>
>>
>
|