<?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: Including Data from another Table without using Join in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Including-Data-from-another-Table-without-using-Join/m-p/750800#M236220</link>
    <description>I specified "without using Join" because that's the only way I've used to connect data prior to this and since I don't really have a common ID to join them by. I just wanted to collect a Count from the other table.&lt;BR /&gt;&lt;BR /&gt;Allright, thanks for the note on Log, will do that</description>
    <pubDate>Mon, 28 Jun 2021 13:22:32 GMT</pubDate>
    <dc:creator>Blomman007</dc:creator>
    <dc:date>2021-06-28T13:22:32Z</dc:date>
    <item>
      <title>Including Data from another Table without using Join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Including-Data-from-another-Table-without-using-Join/m-p/750796#M236217</link>
      <description>&lt;P class="_1qeIAgB0cPwnLhDF9XSiJM"&gt;Hi!&lt;/P&gt;&lt;P class="_1qeIAgB0cPwnLhDF9XSiJM"&gt;I'm fairly new to SAS (Proc SQL) and feel a little out of my depth here. I've seen what I'm trying to do be done in other programs, but when I try to adapt it to my script it doesn't work and I can't figure out why. I've tried searching for solutions but without luck, any help would be greatly appreciated. I'm using SAS EG 8.3.&lt;/P&gt;&lt;P class="_1qeIAgB0cPwnLhDF9XSiJM"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="_1qeIAgB0cPwnLhDF9XSiJM"&gt;I have two tables with data, I want to count data from a column (Called "Account" ) from Table 1 (called "Renewals") and divide it by another counted data column (called "Closed_Accounts") in Table 2 (called "Closed").&lt;/P&gt;&lt;P class="_1qeIAgB0cPwnLhDF9XSiJM"&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc sql;
        Create Table Summary As
           Select
              &amp;amp;Month As Month,
		      Count(T1.Account) As Contracts_w_Renewal,
		      Count(Select Distinct Closed_Accounts From work.closed) As Closed_Contracts,
              Calculated Contracts_w_Renewal/Calculated Closed_Contracts format = percent10.2 AS Renewal_Rate
            
          FROM work.Renewals As T1      

	;Quit; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P class="_1qeIAgB0cPwnLhDF9XSiJM"&gt;This error 22-322: Syntax error, expecting one of... you get the rest &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; is genereted on this part:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Count(Select Distinct Closed_Accounts From work.closed) As Closed_Contracts,&lt;/CODE&gt;&lt;/PRE&gt;&lt;P class="_1qeIAgB0cPwnLhDF9XSiJM"&gt;and I can't figure out why.&lt;/P&gt;&lt;P class="_1qeIAgB0cPwnLhDF9XSiJM"&gt;All I really want to do is count the number of "Closed Accounts" from that table and have the output like this:&lt;BR /&gt;&lt;BR /&gt;Month&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;No of A from T1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; No of A from T2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %-rate&lt;/P&gt;&lt;P class="_1qeIAgB0cPwnLhDF9XSiJM"&gt;&amp;amp;month.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;x&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; y&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x/y&lt;/P&gt;&lt;P class="_1qeIAgB0cPwnLhDF9XSiJM"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="_1qeIAgB0cPwnLhDF9XSiJM"&gt;Please let me know if I should clarify anything, any assistance is appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jun 2021 13:03:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Including-Data-from-another-Table-without-using-Join/m-p/750796#M236217</guid>
      <dc:creator>Blomman007</dc:creator>
      <dc:date>2021-06-28T13:03:19Z</dc:date>
    </item>
    <item>
      <title>Re: Including Data from another Table without using Join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Including-Data-from-another-Table-without-using-Join/m-p/750798#M236219</link>
      <description>&lt;P&gt;Why would you specify "without using join"?? I would think the most logical way and easiest way is to use a join. But to do a join, we need some sort of ID on which the two tables can be aligned, and I don't see where you have explained that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, please, from now on, when you get an error in the log, SHOW US the log for that PROC (or DATA step), the whole log for that PROC (or DATA step), all of the log, with nothing chopped out, so we can see the code and the ERRORs, WARNINGs, and NOTEs exactly as it appears in the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jun 2021 13:19:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Including-Data-from-another-Table-without-using-Join/m-p/750798#M236219</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-06-28T13:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: Including Data from another Table without using Join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Including-Data-from-another-Table-without-using-Join/m-p/750800#M236220</link>
      <description>I specified "without using Join" because that's the only way I've used to connect data prior to this and since I don't really have a common ID to join them by. I just wanted to collect a Count from the other table.&lt;BR /&gt;&lt;BR /&gt;Allright, thanks for the note on Log, will do that</description>
      <pubDate>Mon, 28 Jun 2021 13:22:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Including-Data-from-another-Table-without-using-Join/m-p/750800#M236220</guid>
      <dc:creator>Blomman007</dc:creator>
      <dc:date>2021-06-28T13:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Including Data from another Table without using Join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Including-Data-from-another-Table-without-using-Join/m-p/750809#M236228</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/387575"&gt;@Blomman007&lt;/a&gt;&amp;nbsp;and welcome to the SAS Support Communities!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/387575"&gt;@Blomman007&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Count(Select Distinct Closed_Accounts From work.closed) As ...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Is it the number of distinct values of &lt;FONT face="courier new,courier"&gt;Closed_Accounts&lt;/FONT&gt; in &lt;FONT face="courier new,courier"&gt;work.closed&lt;/FONT&gt; that you want to select by the above expression? If so, just change the order of the COUNT function and the SELECT statement as in&lt;/P&gt;
&lt;PRE&gt;&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;(select count&lt;/STRONG&gt;&lt;/FONT&gt;(distinct closed_accounts) from work.closed&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;)&lt;/FONT&gt;&lt;/STRONG&gt; as ...&lt;/PRE&gt;
&lt;P&gt;The outer parentheses around this subquery are important.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jun 2021 13:41:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Including-Data-from-another-Table-without-using-Join/m-p/750809#M236228</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-06-28T13:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: Including Data from another Table without using Join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Including-Data-from-another-Table-without-using-Join/m-p/750813#M236230</link>
      <description>Awesome! works like a charm. Thanks &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;</description>
      <pubDate>Mon, 28 Jun 2021 13:51:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Including-Data-from-another-Table-without-using-Join/m-p/750813#M236230</guid>
      <dc:creator>Blomman007</dc:creator>
      <dc:date>2021-06-28T13:51:53Z</dc:date>
    </item>
  </channel>
</rss>

