|
Walter,
You could use the index function something like this:
Data findem;
Set <your data>;
where index(x,"9") > 0;
or you could use an if condition:
if index(x,"9") > 0;
run;
HTH
Toby Dunn
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Walter Scott
Sent: Friday, July 23, 2004 8:59 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Position in a String
You can try:
if input(badnum,3.0)=9; /* assumes badnum is a char var w/ length
<=3;" */
or
if input(left(badnum),3.0)=9; /* assumes badnum is a char var of any
length */
>>> x x <sas_user2000@YAHOO.COM> 04:10:37 23-Jul-04 >>>
Hi all,
I am a newbie with 8.2 on WIN platform.
I have a dataset with a field which is or should be a
4 digit number entered as a character.
Due to data entry error the field may have 1, 2, or 3
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 know
what record they belong to but not knowing in what
position the number or numbers may be I was wondering
if there is a simpeler method that can look for the
number or numbers any of the 4 positions in the field?
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";
run;
Cheers
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail
|