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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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