Date: Fri, 30 Dec 2005 07:40:08 -0500
Reply-To: "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Subject: Re: An only numbers string. Alpha's out! Symbols out! The
On Thu, 29 Dec 2005 05:11:57 -0500, Dirk VK <dirk.vk@GMAIL.COM> wrote:
>I have a character variable, named nace_cd, that should contain only the
>numbers 0 to 9.
I'm guessing you really mean the digit characters '0' through '9'.
Regular expressions are an excellent way to perform pattern matching and
nace_cd_digitsOnly = prxchange ('s/[^\d]//', -1, nace_cd);
There are many other SAS functions and routines available (such as COMPRESS)
that deal with strings in more specific (or restricted) ways than the PRX*
family. The functions that work on a problem in a 'restricted domain space'
will generally operate faster (on large volumes of data) than the general
purpose PRX* family.