The SAS Output Delivery System and reporting techniques

Quick SQL Question

Super Contributor
Posts: 358

Quick SQL Question

Hi All:

A quick question about how to code an SQL:

I have a prefix value (a data set name) in one table, and a fully qualified name (including the member name and extension) in a second table.

Is there a way to code a SQL to match these?  I thought to use something like:

where a.prefix =: b.dsn

but this will not work.

I am not concerned whether the fully qualified name contains multiple sub directories, as long as the prefix matches.

Thanks in advance.

Frequent Contributor
Posts: 129

Re: Quick SQL Question

Try like operator with multi-character wild card "%'

where b.dsn like trim(a.prefix)||'%'

Respected Advisor
Posts: 3,156

Re: Quick SQL Question

colon operator is not working in Proc SQL, you probably need to use scan():

where a.prefix=scan(b.dsn,1)


Super User
Posts: 5,365

Re: Quick SQL Question

I suspect LarryWorley hit the nail on the head, but just in case this should be worth a shot:

where trim(a.prefix) = substr(b.dsn, 1, length(a.prefix))

Ask a Question
Discussion stats
  • 3 replies
  • 4 in conversation