<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Trips from two tables in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trips-from-two-tables/m-p/179350#M13715</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Assume both of your SAS tables share the identical variables, a simple approach could be the following 2-3 steps:&lt;/P&gt;&lt;P&gt;1. Append both tables (SET / PROC APPEND/ PROC SQL UNION)&lt;/P&gt;&lt;P&gt;2. Sort it by Customer_ID and Game_date (PROC SORT/PROC SQL/HASH etc)&lt;/P&gt;&lt;P&gt;3. Dedup using PROC SORT/DATA STEP -- FIRST.VAR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Been saying so much, I am just as confused as Reeza without knowing anything about your data structure and your expected outcome.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Feb 2015 02:59:45 GMT</pubDate>
    <dc:creator>Haikuo</dc:creator>
    <dc:date>2015-02-24T02:59:45Z</dc:date>
    <item>
      <title>Trips from two tables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trips-from-two-tables/m-p/179346#M13711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I have two data tables: Table1 and Table2. I want to combine the trips based on the PlayDate.&amp;nbsp; I don't want this syntax "T1 Trips + T2 Trips" cause this will give me 2 instead of 1 because Customer 1 played only 1 time in the date 2-12-2014:&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 363px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="19" width="77"&gt;Table 1&lt;/TD&gt;&lt;TD width="222"&gt;PlayDate&lt;/TD&gt;&lt;TD width="64"&gt;Trips&lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD height="19"&gt;Customer 1&lt;/TD&gt;&lt;TD class="xl64"&gt;2/12/2014&amp;nbsp; 1:15am&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt; &lt;/TR&gt;&lt;TR&gt;&lt;TD height="19"&gt;Table2&lt;/TD&gt;&lt;TD&gt;PlayDate&lt;/TD&gt;&lt;TD&gt;Trip&lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD height="19"&gt;Customer 1&lt;/TD&gt;&lt;TD class="xl64"&gt;2/12/2014 2:00pm&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt; &lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 01:06:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trips-from-two-tables/m-p/179346#M13711</guid>
      <dc:creator>sdang</dc:creator>
      <dc:date>2015-02-24T01:06:08Z</dc:date>
    </item>
    <item>
      <title>Re: Trips from two tables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trips-from-two-tables/m-p/179347#M13712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What do you mean by combine? Post sample output please.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 01:27:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trips-from-two-tables/m-p/179347#M13712</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-02-24T01:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: Trips from two tables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trips-from-two-tables/m-p/179348#M13713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I deal with casino data, when a customer game in at our&lt;BR /&gt;&lt;SPAN style="line-height: 115%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;property on a given day &lt;/SPAN&gt;we counted them at one trip overall. &lt;BR /&gt;But If I played at table games at 1:00PM, TableGames rating system will&lt;BR /&gt;count me as one trip.&amp;nbsp; However, if I moved&lt;BR /&gt;to slot games at 2:00PM, SlotGames rating system will count be as one trip.&lt;BR /&gt;This is how our SAS databases are structured. &lt;BR /&gt;I want the trip for that one day at our gaming premise.&amp;nbsp;&amp;nbsp; The syntax "T1 Trips + T2 Trips" will give me 2 trips total in 2-12-2014; even though I only game one time at the &lt;SPAN style="line-height: 115%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;property.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 01:36:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trips-from-two-tables/m-p/179348#M13713</guid>
      <dc:creator>sdang</dc:creator>
      <dc:date>2015-02-24T01:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: Trips from two tables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trips-from-two-tables/m-p/179349#M13714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm sorry, I don't understand what your output should be. Based on the data you've provided what do you want the output to look like?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 01:45:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trips-from-two-tables/m-p/179349#M13714</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-02-24T01:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: Trips from two tables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trips-from-two-tables/m-p/179350#M13715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Assume both of your SAS tables share the identical variables, a simple approach could be the following 2-3 steps:&lt;/P&gt;&lt;P&gt;1. Append both tables (SET / PROC APPEND/ PROC SQL UNION)&lt;/P&gt;&lt;P&gt;2. Sort it by Customer_ID and Game_date (PROC SORT/PROC SQL/HASH etc)&lt;/P&gt;&lt;P&gt;3. Dedup using PROC SORT/DATA STEP -- FIRST.VAR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Been saying so much, I am just as confused as Reeza without knowing anything about your data structure and your expected outcome.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 02:59:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trips-from-two-tables/m-p/179350#M13715</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-02-24T02:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: Trips from two tables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trips-from-two-tables/m-p/179351#M13716</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have some limited experience with gaming data.&amp;nbsp; From your question, I assume that you are getting one table per game "source", and you wish to combine these sources to see a larger picture of a customer's total activity.&amp;nbsp; You want to understand the activity "per trip", which maybe you're defining as activity within a single gaming day.&amp;nbsp; In the casino world, the "gaming day" usually does not start at midnight but at some other time defined either by the casino or a regulatory agency.&amp;nbsp; For example, the gaming day might begin at 6:00 AM, even though the casino operates on a 24-hour schedule.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So let's generate some sample data for two games with customer IDs and their playing times:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="font-family: Consolas; font-size: 11pt;"&gt;&lt;SPAN style="color: #008000; background-color: #ffffff;"&gt;/* creat sample data - one table per game */&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;data&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; slots;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; customerId $ &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;15&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; timestamp &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;8&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;infile&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;datalines&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;dsd&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; timestamp &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;datetime20.&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; customerId timestamp:&lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;anydtdtm20.&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;datalines&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffc0;"&gt;1001, 01/04/2015 1:15&lt;BR /&gt;1002, 01/04/2015 1:16&lt;BR /&gt;1003, 01/04/2015 12:30&lt;BR /&gt;1001, 01/04/2015 16:15&lt;BR /&gt;&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; blackjack;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; customerId $ &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;15&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; timestamp &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;8&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;infile&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;datalines&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;dsd&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; timestamp &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;datetime20.&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; customerId timestamp:&lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;anydtdtm20.&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;datalines&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffc0;"&gt;1010, 01/03/2015 23:17&lt;BR /&gt;1011, 01/04/2015 00:30&lt;BR /&gt;1012, 01/04/2015 03:15&lt;BR /&gt;1001, 01/05/2015 01:15&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This results in two tables, with some of the records pertaining to the same customer:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="sampledata.png" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/9357_sampledata.png" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next, let's combine those data sources and "tag" each record for the game played (slots or blackjack).&amp;nbsp; Also, assuming a 6:00 AM start to the gaming day, we'll create a &lt;STRONG&gt;GAMINGDAY&lt;/STRONG&gt; date field that normalizes the data according to the calculated gaming day.&amp;nbsp; Finally, we'll sort the output by gaming day and customer ID, so we can easily see how much activity a customer had on a particular day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="font-family: Consolas; font-size: 11pt;"&gt;&lt;SPAN style="color: #008000; background-color: #ffffff;"&gt;/* Assuming gaming day begins at 06:00 AM */&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; allgames;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; game $ &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;10&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; gamingday &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;8&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; gamingday &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;DATE9.&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; slots(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=s) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; blackjack(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=b);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; background-color: #ffffff;"&gt;/* segment the games */&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; (s) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; game=&lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;"SLOTS"&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;else&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; (b) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; game=&lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;"BLACKJACK"&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; background-color: #ffffff;"&gt;/* Adjust for gaming day */&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; timepart(timestamp)&amp;lt;&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;'06:00:00't&lt;/STRONG&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; gamingday=datepart(timestamp)-&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;else&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; gamingday=datepart(timestamp);&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008000; background-color: #ffffff;"&gt;/* output the data, grouping by game day and customer */&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;sort&lt;/STRONG&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=allgames &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=allgames;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; gamingday customerId;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result shows how a customer played multiple games in a single gaming day.&amp;nbsp; Notice how even when the timestamps span two calendar days, the "gaming day" groups the customer activity together.&amp;nbsp; (When does this customer sleep, you wonder?&amp;nbsp; That's a question that casinos probably don't worry too much about.)&lt;/P&gt;&lt;P&gt;&lt;IMG alt="sampleresult.png" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/9358_sampleresult.png" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What you do next with this data will depend on your purpose.&amp;nbsp; You might combine it with other data about money spent on games or on meals, seasonal activity data, and whatever else you know about the customer to plan the best offers that a customer might respond to.&amp;nbsp; Or perhaps you're just looking for more of an operational view of gaming activity at the customer/patron level.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 13:31:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trips-from-two-tables/m-p/179351#M13716</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2015-02-24T13:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: Trips from two tables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trips-from-two-tables/m-p/179352#M13717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chris,&lt;/P&gt;&lt;P&gt;You are on the spot about "per trip" as defines as total activities in &lt;STRONG&gt;one gaming day.&lt;/STRONG&gt; If a guest plays table games and slot games in one day, our current data structure shows up in two tables.&amp;nbsp; Below I used inner join for&amp;nbsp; three tables: Guest, Slot, and Table.&amp;nbsp; The result looks like this. &lt;/P&gt;&lt;P&gt;As you can see guest 1001 played total times in one day in TablePlayerDayDate1 even though he/she did not have multiple transactions.&amp;nbsp; Now how do I get their trips based on their one gaming day?&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/9369_Capture.PNG" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Feb 2015 20:16:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trips-from-two-tables/m-p/179352#M13717</guid>
      <dc:creator>sdang</dc:creator>
      <dc:date>2015-02-25T20:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: Trips from two tables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trips-from-two-tables/m-p/179353#M13718</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Reeza and &lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" data-avatarid="1025" data-externalid="" data-presence="null" data-userid="5068" data-username="Hai.kuo" href="https://communities.sas.com/people/Hai.kuo" id="jive-506840275363606355186"&gt;Hai.kuo&lt;/A&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Feb 2015 20:18:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trips-from-two-tables/m-p/179353#M13718</guid>
      <dc:creator>sdang</dc:creator>
      <dc:date>2015-02-25T20:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: Trips from two tables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trips-from-two-tables/m-p/179354#M13719</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Feb 2015 20:20:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trips-from-two-tables/m-p/179354#M13719</guid>
      <dc:creator>sdang</dc:creator>
      <dc:date>2015-02-25T20:20:13Z</dc:date>
    </item>
  </channel>
</rss>

