Date: Mon, 27 Sep 2010 17:46:45 -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: Character and Alphanumeric values
Content-Type: text/plain; charset="us-ascii"
One of our former active participants who now lurks pointed out that a
better if statement would be
if Anydigit ( var ) then output AlphaNum;
Nat
-----Original Message-----
From: Nat Wooding [mailto:nathani@verizon.net]
Sent: Monday, September 27, 2010 5:20 PM
To: 'SAS-L@LISTSERV.UGA.EDU'
Subject: RE: Character and Alphanumeric values
The following will segregate the purely alpha strings from the mixed
strings.
Nat Wooding
data have ;
infile datalines;
informat var $25.;
input var;
datalines;
aa
ab
abc
abcde
abcdefghijklmnopqrstuvwxyz
a23
b1
ab2
;
Data AlphaNUM Alpha;
set have;
if Compress ( var , ' ' , 'a' ) ge '0' then output AlphaNum;
else output Alpha;
proc print;
run;
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Ravinder.Maramamula
Sent: Monday, September 27, 2010 12:08 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Character and Alphanumeric values
Gerhard,
Sorry for the confusion ,I want to remove all the patterns which are
associated with numbers.
so i want to remove all the below patterns and want to put in another
dataset.
a1,a21,ab1,abc231,a1bcdef .
How can i achieve that ,any help in this aspect is well appreciated.
Thanks,
Ravinder
On Mon, Sep 27, 2010 at 9:18 PM, Gerhard Hellriegel <
gerhard.hellriegel@t-online.de> wrote:
> for me it is not fully clear what you want. You write, you want to remove
> all the alphanumeric data and place it in another dataset. Alphanumeric is
> ALL, numbers and characters! What do you want to remove? Your example
> seems to extract only records without any numeric part. The "want"
> dataset, is that the "other" - dataset, or that what remains after
> removing something. What is with data with any number-parts? Records
> deleted?
>
> I'm not aware of any informat for telephone numbers. Think there are no
> real standards for the numbers.
> With the compress-function you can remove anything what you don't want,
> including blanks, -, (, ), ....
>
> data a;
> x="(123) - 123456";
> y=compress(x,"(),.+-[] ");
> put x= / y=;
> run;
>
> Gerhard
>
>
>
>
>
> On Mon, 27 Sep 2010 06:06:09 -0400, Ravinder.Maramamula
> <ravinsun@GMAIL.COM> wrote:
>
> >Hi list,
> >
> >
> >I have a dataset and it contains a character variable which
> >has mixture of values like character and alphanumeric.
> >I want to validate the dataset and remove all the alphanumeric
> >values and place it in another dataset.
> >
> >data have ;
> >infile datalines;
> >input var;
> >datalines;
> >aa
> >ab
> >abc
> >abcde
> >....
> >...
> >abcdefghijklmnopqrstuvwxyz
> >a23
> >b1
> >ab2
> >;
> >dataset want:
> >aa
> >ab
> >abc
> >abcde
> >.....
> >.....
> >abcdefghijklmnopqrstuvwxyz
> >;
> >Do we have any informat which would directly read telephone numbers of
> type
> >(987)6543210 as 9876543210.
> >
> >Thanks in advance for your time.
> >
> >Regards,
> >Ravi
>
--
TOUGHT TIMES NEVER LAST!!!!!BUT TOUGH PEOPLE DO!!!!!
|