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

I want to run a query based on the logic below:

If  t1.PlayerDayDate=t2.NewEnrollmentDate then get the next three days of  t1.PlayerDayDate of that respective patron.

I want to see when a customer enrolled on that day and play (hence playdate=new enrollmentdate) then also get the next three days transaction or play days.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

I hope this can be done in EG. Assuming both your dates are datetimes, use INTCK to count the number of days between play and enrolment :

proc sql;

create table nextDays as

select t2.newEnrolmentDate, t1.*

from

  PlayerDays as t1 inner join

  Enrolments as t2 on

       t1.guestNumber=t2.guestNumber and

       intck("DTDAY", t2.newEnrolmentDate, t1.PlayerDayDate) between 0 and 3;

quit;

(untested)

PG

PG

View solution in original post

6 REPLIES 6
ballardw
Super User

You should provide a couple of small example data sets and what the desired output would look like.

sdang
Quartz | Level 8

Hi,

Below are the results of filtering t1.PlayerDayDate=t2.NewEnrollmentDate.  Now I want the next three PlayerDayDate since the day that they enrolled.

Data are taken from WORK.QUERY_FOR_TOTALGAMINGADDRES_0001

Capture.PNG

I hope this helps.

PGStats
Opal | Level 21

I hope this can be done in EG. Assuming both your dates are datetimes, use INTCK to count the number of days between play and enrolment :

proc sql;

create table nextDays as

select t2.newEnrolmentDate, t1.*

from

  PlayerDays as t1 inner join

  Enrolments as t2 on

       t1.guestNumber=t2.guestNumber and

       intck("DTDAY", t2.newEnrolmentDate, t1.PlayerDayDate) between 0 and 3;

quit;

(untested)

PG

PG
sdang
Quartz | Level 8

Thank you.  You solved my problem.

TomKari
Onyx | Level 15

I haven't tested it, but I believe it would be doable with the EG query builder.

Tom

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 6 replies
  • 2238 views
  • 0 likes
  • 4 in conversation