BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
itshere
Obsidian | Level 7

Hi - 

 

I have a table that has an start date and an end date and need to see if a call was made on the start date or the end date. this is my current query but it does not work. 

 

rsubmit;
proc sql;
create table test.field1 as
select
A.*,
B.*
from test.rock A
left join test.paper B
on A.account = B.account 
and A.start_date = B.call_date
or A.end_date = B.call_date
;
endrsubmit;

 

So ideally i want to get a table that shows me all the interactions I got that matched the start date and end date WITH the call_date(different table)

 

**the interactions are linked to Call_date which is a different table. 

 

This is the error i got...

 

NOTE: The execution of this query involves performing one or more Cartesian product joins that
can not be optimized.
ERROR: A lock is not available for test.field
ERROR: Lock held by process 5229800

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisNZ
Tourmaline | Level 20

There shouldnt be a cartesian product if you write the boolean clause the way you mean it:

on A.account = B.account 
and (A.start_date = B.call_date
    or A.end_date = B.call_date)

View solution in original post

1 REPLY 1
ChrisNZ
Tourmaline | Level 20

There shouldnt be a cartesian product if you write the boolean clause the way you mean it:

on A.account = B.account 
and (A.start_date = B.call_date
    or A.end_date = B.call_date)

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 628 views
  • 1 like
  • 2 in conversation