<?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: joined three tables result is not pretty in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182267#M13950</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Based on your previous question, I think you're supposed to append the tables not join them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please simplify the problem, post a single data sample, not a picture, and the expected output from that sample data?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 26 Feb 2015 00:30:11 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2015-02-26T00:30:11Z</dc:date>
    <item>
      <title>joined three tables result is not pretty</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182266#M13949</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; In the casino industry, trip defines as total activities&lt;BR /&gt;within day.&amp;nbsp; A guest might play table&lt;BR /&gt;games then turn around and play slot games the next hour; we count that as 1&lt;BR /&gt;trip.&amp;nbsp; However, our data structure&lt;BR /&gt;divided Slot and Table separate.&amp;nbsp; A guest&lt;BR /&gt;can be In two tables within a given day. Below I used inner join for three&lt;BR /&gt;tables: Guest, Slot, and Table.&amp;nbsp; The&lt;BR /&gt;result looks like the picture below. As you can see guest 1001 played total&lt;BR /&gt;times in one day in TablePlayerDayDate1 even though he/she did not have&lt;BR /&gt;multiple transactions.&amp;nbsp; Now how do I get&lt;BR /&gt;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/9370_Capture.PNG" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Feb 2015 22:50:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182266#M13949</guid>
      <dc:creator>sdang</dc:creator>
      <dc:date>2015-02-25T22:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: joined three tables result is not pretty</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182267#M13950</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Based on your previous question, I think you're supposed to append the tables not join them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please simplify the problem, post a single data sample, not a picture, and the expected output from that sample data?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 00:30:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182267#M13950</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-02-26T00:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: joined three tables result is not pretty</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182268#M13951</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm sorry about the confusion.&amp;nbsp; I'm new to SAS Guide and Communities. Please see below.&amp;nbsp; I hope it helps.&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 432px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="20" width="119"&gt;SlotGuestNumber&lt;/TD&gt;&lt;TD width="86"&gt;SlotPlayDate&lt;/TD&gt;&lt;TD width="130"&gt;TableGuestNumber&lt;/TD&gt;&lt;TD width="97"&gt;TablePlayDate&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1001&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;4-Mar-14&lt;/TD&gt;&lt;TD align="right"&gt;1001&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;4-Mar-14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1001&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;11-Mar-14&lt;/TD&gt;Sample Data.&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1001&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;18-Mar-14&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want it to look like below, regardless of time stamps.&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 205px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="20" width="119"&gt;GuestNumber&lt;/TD&gt;&lt;TD width="86"&gt;PlayDate&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1001&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;4-Mar-14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1001&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;11-Mar-14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1001&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;18-Mar-14&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 00:45:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182268#M13951</guid>
      <dc:creator>sdang</dc:creator>
      <dc:date>2015-02-26T00:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: joined three tables result is not pretty</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182269#M13952</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That looks like you just want the first two columns? So ignore the last two or drop them?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 02:11:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182269#M13952</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-02-26T02:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: joined three tables result is not pretty</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182270#M13953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I try to specify the situation:&lt;/P&gt;&lt;P&gt;- 1 dataset for holding guest data&lt;/P&gt;&lt;P&gt;- 1 dataset for slot playing&lt;/P&gt;&lt;P&gt;- 1 dataset for table playing&lt;/P&gt;&lt;P&gt;All datasets have the Guestnumber in common, although with different names; the same is true for the dates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My suggestion:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data intermediate;&lt;/P&gt;&lt;P&gt;set&lt;/P&gt;&lt;P&gt;&amp;nbsp; slotplaying (&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; keep=SlotGuestNumber1 SlotPlayDate&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rename=(SlotGuestNumber1=GuestNumber SlotPlayDate=PlayDate)&lt;/P&gt;&lt;P&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp; tableplaying (&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; keep=TableGuestNumber2 TablePlayDate1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rename=(TableGuestNumber2=GuestNumber TablePlayDate1=PlayDate)&lt;/P&gt;&lt;P&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort&lt;/P&gt;&lt;P&gt;&amp;nbsp; data=intermediate&lt;/P&gt;&lt;P&gt;&amp;nbsp; out=want&lt;/P&gt;&lt;P&gt;&amp;nbsp; nodupkey&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;by GuestNumber PlayDate;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now you can join the dataset want with your basic guest dataset on GuestNumber.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 06:33:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182270#M13953</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-02-26T06:33:44Z</dc:date>
    </item>
    <item>
      <title>Re: joined three tables result is not pretty</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182271#M13954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I want to combine SlotGuestNumber and TableGuestNumber under the a new column GuestNumber.&amp;nbsp; Same goes with SlotPlayDate and Table PlayDate.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 18:07:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182271#M13954</guid>
      <dc:creator>sdang</dc:creator>
      <dc:date>2015-02-26T18:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: joined three tables result is not pretty</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182272#M13955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I do have dataset Guest but it does not have PlayDate.&amp;nbsp; I want to combine SlotGuestNumber and TableGuestNumber under the a new column GuestNumber.&amp;nbsp; Same goes with SlotPlayDate and Table PlayDate under a new column "PlayDate". &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 18:12:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182272#M13955</guid>
      <dc:creator>sdang</dc:creator>
      <dc:date>2015-02-26T18:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: joined three tables result is not pretty</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182273#M13956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;It may be best if you post what each of your three tables look like and then what you want your output is, if you don't understand @kurtbremser solution or my suggestions. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I agree with Kurt and you're not trying to join tables, you need to append (stack) them. To do this, you need to rename the variables so that they have the same name and then use the append task or do a UNION in SQL. I'm not sure if you can do a UNION operation in EG Query Builder. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In creating the stacked file I would create an ID indicating Slot or Table so you can identify the source, more than likely this will be important in a future step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once you have the stacked file, you can use the SORT task/procedure to remove duplicates. Or you can use DISTINCT in Query Builder to achieve the analysis you want. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 18:58:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182273#M13956</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-02-26T18:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: joined three tables result is not pretty</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182274#M13957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying all of suggestions here. Still new to SAS so it takes some times to see if they work. Much appreciated. Below are images of my dataset. In order: Guest, Slot, Table and result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image" src="https://communities.sas.com/legacyfs/online/9374_Capture.PNG" /&gt;&lt;/P&gt;&lt;P&gt;Slot DataSet&lt;/P&gt;&lt;P&gt;&lt;IMG alt="CaptureSlot.PNG" class="jive-image" src="https://communities.sas.com/legacyfs/online/9375_CaptureSlot.PNG" /&gt;&lt;/P&gt;&lt;P&gt;Table dataset&lt;/P&gt;&lt;P&gt;&lt;IMG alt="CaptureTable.PNG" class="jive-image" src="https://communities.sas.com/legacyfs/online/9376_CaptureTable.PNG" /&gt;&lt;/P&gt;&lt;P&gt;Below is the result I wanted but as you can see how SlotPlayDate data repeats itself until a new date was available.&amp;nbsp; I don't want that to happen.&amp;nbsp; How can I create a new column that combines SlotPlayDate and TablePlayerDayDate1 together?&lt;/P&gt;&lt;P&gt;&lt;IMG alt="CaptureCombine.PNG" class="jive-image" src="https://communities.sas.com/legacyfs/online/9377_CaptureCombine.PNG" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 19:20:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182274#M13957</guid>
      <dc:creator>sdang</dc:creator>
      <dc:date>2015-02-26T19:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: joined three tables result is not pretty</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182275#M13958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok&lt;/P&gt;&lt;P&gt;From what I see, the guest table does not add any information so you can ignore it for now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't think the table you're looking to create will make sense and will be useful for analysis, in my experience. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps the following might work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Guest Number PlayDate Game&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 09Jan2014 Slot&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 09Jan2014 Table&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 09Jan2014 Slot &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What type of analysis are you trying to perform?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 19:31:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182275#M13958</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-02-26T19:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: joined three tables result is not pretty</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182276#M13959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That could work on some cases.&amp;nbsp; But what if I do a count-we call it 'gaming trips'- and it defines as one gaming day.&amp;nbsp; In this case GuestNumber 3 will have three gaming trips.&amp;nbsp; I do I make the date distinct?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 19:48:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182276#M13959</guid>
      <dc:creator>sdang</dc:creator>
      <dc:date>2015-02-26T19:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: joined three tables result is not pretty</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182277#M13960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not familiar with that metric - gaming trips - if its the number of trips per year or something you can calculate that in multiple ways and distinct is one way.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wouldn't necessarily change the data structure, I would use distinct in the query. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or you can use a summary procedure to collapse by guest/date, assuming you also have amounts attached to each of those slot/table then you can also summarize the total amounts per day/game or overall if required.&amp;nbsp; You wouldn't be able to do that with your other structure. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 19:55:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182277#M13960</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-02-26T19:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: joined three tables result is not pretty</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182278#M13961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you all!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 19:57:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/joined-three-tables-result-is-not-pretty/m-p/182278#M13961</guid>
      <dc:creator>sdang</dc:creator>
      <dc:date>2015-02-26T19:57:37Z</dc:date>
    </item>
  </channel>
</rss>

