LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2005, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
              horror... ;-)

On Thu, 29 Dec 2005 05:11:57 -0500, Dirk VK <dirk.vk@GMAIL.COM> wrote:

>Hello, > >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 replacement.

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.


Back to: Top of message | Previous page | Main SAS-L page