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

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 ???
1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

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

2 REPLIES 2
novinosrin
Tourmaline | Level 20

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;

 

 

art297
Opal | Level 21

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

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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