DATA Step, Macro, Functions and more

SAS String Function to lookup certain character?

Reply
N/A
Posts: 0

SAS String Function to lookup certain character?

Hi

I want to delete from an input dataset whenever a certain record contains the - (dash) character.

For example, Serial Number 125345-5545

So, if there is such a serial number like this, I want to exclude it from the input dataset

DATA XXXX;
INPUT YYYY;
@01 Serial $10.
;

Is there a string function that parses "Serial" in this case such that I can say something like this:

if SomeStringFunction(Serial,"-") then delete;

Thanks
Shelton.
Super User
Posts: 5,256

Re: SAS String Function to lookup certain character?

if index(serial,'-') then delete;

would probably do the job.

Regards,
Linus
Data never sleeps
N/A
Posts: 0

Re: SAS String Function to lookup certain character?

Thankyou Linus - that worked.

Cheers
Shelton.
Ask a Question
Discussion stats
  • 2 replies
  • 119 views
  • 0 likes
  • 2 in conversation