|Date: ||Mon, 26 Sep 2005 11:09:41 -0400|
|Reply-To: ||Venky Chakravarthy <swovcc@HOTMAIL.COM>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||Venky Chakravarthy <swovcc@HOTMAIL.COM>|
|Subject: ||Re: A SAS Question|
data test ;
length dsn $44 ;
input @1 dsn $char44. ;
data test2 ;
set test ;
if substr(dsn,length(scan(dsn,1))+1,1)^="." then delete ;
Here, the SCAN operates with the default set of delimiters. In your case it
is either a period or a blank. Find the length of the string returned by
the SCAN and add 1 to it to determine the position right after it. Look at
that byte with a SUBSTR. If it is not a period then delete that
observation. If you want only blanks to be deleted then change the RHS of
the equation accordingly. If the volume of data is huge and it meets other
conditions to make a WHERE statement more efficient then use that.
where substr(dsn,length(scan(dsn,1))+1,1)="." ;
On Mon, 26 Sep 2005 10:22:13 -0400, Srna, Carol (C.) <csrna@FORD.COM> wrote:
>I have a 44 byte character field named DSN.
>Examples of values for field DSN:
>If a value in the DSN does not have a period (dot) behind the first
>hi-level qualifer, I want to discard that record/observation.
>SYSLO (followed by a blank)
>CAROL(followed by a bank)
>ANYHILVL (followed by a blank).
>Any ideas/tips on how I can do this?
>I am researching SUBSTR and maybe INDEX functions.
>Thanks In Advance