Date: Mon, 26 Jul 2004 23:10:31 -0400
Reply-To: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Subject: Re: Position in a String
I think you want to use the VERIFY function. If the stored length of your
variable is 4, it is simply
If BADNUM is longer, you have to allow for the padding which is stored. Try
if verify(substr(badnum,1,4),'0123456789') or length(badnum)>4;
In my earlier post I meant of course to type
if compress(badnum) = '23';
On Mon, 26 Jul 2004 19:53:46 -0700, x x <sas_user2000@YAHOO.COM> wrote:
>> Are you trying to identify all records which violate
>> your validation rule (4 digits), using the single 9
>> simply as an example, or are you trying to
>> differentiate cases among bad values (eg, single 9
>> versus two 9's, or single 8)?
>> If you are trying to standardize by eliminating
>> insignificant blanks, and if some of the values to
>> be processed contain two or three digits and
>> possibly embedded blanks, use the COMPRESS function.
>> For example
>> if compress badnum = '23';
>> will dredge not only '23' but '2 3' and ' 23'.
>That is precisely what i want to do. As you say, not
>only I need to scan for values that violate the 4
>digit rule and as in your example above but I also
>need to identify any posible violation of that rule.
>The purpose is to identify and locate the errots adn
>if possible clean up and/or massage the data to be
>I dont need to identify blanks.
>> >4 digit number entered as a character.
>> >Due to data entry error the field may have 1, 2, or
>> >digits and in any position. ie "9 " or " 9 " or
>> >9 " or " 9".
>> >I do have a list of those numbers and i need to
>> >what record they belong to but not knowing in what
>> >position the number or numbers may be I was
>> >if there is a simpeler method that can look for the
>> >number or numbers any of the 4 positions in the
>> >I have been using the following for each position
>> >which is time consuming. Is there an easier way?
>> >data temp;
>> >set numberslist;
>> >if badnum ="9 " or badnum = " 9 " or badnum=" 9
>> >or badnum= " 9";
>> >Do you Yahoo!?
>> >New and Improved Yahoo! Mail - 100MB free storage!
>Do you Yahoo!?
>Yahoo! Mail - 50x more storage than other providers!