BookmarkSubscribeRSS Feed
Jila_Asgary
Calcite | Level 5

Hello,

Have a 5 years (2014-2018) transactional data which includes Contact_Email2, ordno, order_date, revenue and few more. Using order_date, i created fod_win & lod for each unique email address. 

Q, part 1:

Need to flag monthly new buyers  -  if contact_email2 has an order_date in this month, and if fod_win is in this specific month (so it is truely first order) or the fod_win is not in this month, but they have not ordered in past 24 months flag them as New_buyer.  Since we need 24 months prior history, we will start from 1st month of Jan 2016, and  2014-2015 will be used as past 24 months window .

Q, part 2:

Need to flag monthly repeat buyers  - if contact_email2 has an order_date in this month, and if fod in NOT in this specific, but it is less than prior 24 months window, flag them as repeat.

Need to flag this by month from Jan 2016 - Dec 2018.

Hope the question is clear! Please see a sample of my data set, attached. The data set includes all orders, and you can see dups by email.

In advance thanks very much for help!!

1 REPLY 1
ChrisNZ
Tourmaline | Level 20

Please present simplified set of data as a data step, as well as expected output for the logic you want implemented.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 469 views
  • 0 likes
  • 2 in conversation