BookmarkSubscribeRSS Feed
umashankersaini
Quartz | Level 8

Hi Team,

 

I need to tag customer's transaction to the latest campaign only.

Sample files has been attached with desired result.

let me explain scenario little bit.

 

Suppose i am sending a campaign on 27NOV2020 (EVENT_CAPTURED_DT) with attribution window 27Nov2020+7days =04DEC2020(CPGN_END_DT). Now customer has shopped on 06DEC which is not part of mentioned campaign.

In this case customer would get tagged to another campaign which has end_date greater that transaction date.

In case i have sent multiple campaigns to same customer in a week (different dates) and customer has shopped then customer's transaction would get tagged to last campaign (latest).

 

Sample Files:

CPGN_ORIG - Contains campaign details

ATTRN_ATTRB - Customer's shopping details during attribution window

CPGNS_Final_Output - Required output - Customer's transaction tagged to latest campaign - sample example

 

Proc sql would be first choice as a code. Kindly read the attached file for sample data.

 

Thanks in advance.

Regards,

Uma Shanker Saini

1 REPLY 1
ChrisNZ
Tourmaline | Level 20

1. Do not send MS office files, many people will not/may not open them, and they lack any metadata anyway.

2. Reduce your problem to a small subset of example data

3. Provide that input data so we don't have to work to use it (provide it in the form of a data step or SQL create+insert)

4. Provide the desired output

5. Show what code you've tried (for both the data code and the run code, use the code icon)

 

 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 915 views
  • 0 likes
  • 2 in conversation