Desktop productivity for business analysts and programmers

Where Date in table A is within 35 days of date in table B

Accepted Solution Solved
Reply
Contributor
Posts: 56
Accepted Solution

Where Date in table A is within 35 days of date in table B

Hi all,

 

I'm joining an email activity table (table a) with a email history table (table b). I'm using an inner join to give me all data from table a where the activity_date in that table is within 35 days of the campaign_date (attribution reasons). I'm not sure how the syntax for that works in SAS EG. Can someone help please?

 

Thanks!

 

proc sql;
select * 
	from email_campaign_activity a
	inner join
	email_campaign_history b 
	on a.email_campaign_id = b.email_campaign_id
	where ???

Accepted Solutions
Solution
3 weeks ago
PROC Star
Posts: 1,547

Re: Where Date in table A is within 35 days of date in table B

[ Edited ]

Please meddle around this and see if this works

The addition is 

intck('days',activity_date, campaign_date)<=35;

 

proc sql;
select * 
	from email_campaign_activity a
	inner join
	email_campaign_history b 
	on a.email_campaign_id = b.email_campaign_id and intck('days',activity_date, campaign_date)<=35;
	quit;

 

 

View solution in original post


All Replies
Solution
3 weeks ago
PROC Star
Posts: 1,547

Re: Where Date in table A is within 35 days of date in table B

[ Edited ]

Please meddle around this and see if this works

The addition is 

intck('days',activity_date, campaign_date)<=35;

 

proc sql;
select * 
	from email_campaign_activity a
	inner join
	email_campaign_history b 
	on a.email_campaign_id = b.email_campaign_id and intck('days',activity_date, campaign_date)<=35;
	quit;

 

 

PROC Star
Posts: 8,142

Re: Where Date in table A is within 35 days of date in table B

You didn't provide enough info to show you how to write the code, but take a look at the last post in the thread: https://communities.sas.com/t5/General-SAS-Programming/Checking-if-a-transaction-date-falls-between-...

 

Art, CEO, AnalystFinder.com

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 116 views
  • 0 likes
  • 3 in conversation