<?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: Best way to compare summery data sets in different DB? (my starting point is 3 proc sql... w/ 'a in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Best-way-to-compare-summery-data-sets-in-different-DB-my/m-p/427353#M27533</link>
    <description>Can you fix your query to make it legible?</description>
    <pubDate>Fri, 12 Jan 2018 20:34:47 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-01-12T20:34:47Z</dc:date>
    <item>
      <title>Best way to compare summery data sets in different DB? (my starting point is 3 proc sql... w/ 'as')</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Best-way-to-compare-summery-data-sets-in-different-DB-my/m-p/427307#M27530</link>
      <description>&lt;P&gt;Hello all,&amp;nbsp;&lt;BR /&gt;My question is possibly two part ultimately... (macro idea, or new proc ??)&lt;BR /&gt; I need to compare a list of tables in two databases for differences in their summery per table. I need to do this for many tables but would love to use a 'macro' and pass the table names and the metadata field names (they are different because the DB's they sit on are different. MS SQL - Oracle) and &lt;STRONG&gt;of course the number of fields per table can be different per table in a single&amp;nbsp;db&lt;/STRONG&gt;. However the pairs of tables checked across db's match perfectly.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;What I was wondering is if a macro containing my proc sql could just be fed the table names and data fields and alias's?&amp;nbsp; If anyone had a sample they could share with me? All fields that are not sum-ed can be assumed to be char. In the end we are only looking for groups or counts that are different/missing from one db to the other. Anyway here is my code sample checks one table:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create table student_campus_fte_w as&lt;BR /&gt;select&lt;BR /&gt;&amp;nbsp;w_snapshot as snapshot,&lt;BR /&gt;&amp;nbsp;strm,&lt;BR /&gt;&amp;nbsp;acad_career,&lt;BR /&gt;&amp;nbsp;sum(W_ENRL_CRD_CNT) as enrl_credit_campus_count,&lt;BR /&gt;&amp;nbsp;sum(W_PL_IND) as PULLM_ind,&lt;BR /&gt;&amp;nbsp;sum(W_PL_CRD_IND) as PULLM_credit_ind,&lt;BR /&gt;&amp;nbsp;sum(W_PL_CRD_HOUR) as PULLM_credit_hours,&lt;BR /&gt;&amp;nbsp;/* ... more fields */&lt;BR /&gt;from &amp;amp;destinat..ps_W_STDNT_CMP_FTE&lt;BR /&gt;group by &lt;BR /&gt;&amp;nbsp;w_snapshot,&lt;BR /&gt;&amp;nbsp;strm,&lt;BR /&gt;&amp;nbsp;acad_career&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create table student_campus_fte_c as&lt;BR /&gt;select&lt;BR /&gt;&amp;nbsp;snapshot,&lt;BR /&gt;&amp;nbsp;strm,&lt;BR /&gt;&amp;nbsp;acad_career,&lt;BR /&gt;&amp;nbsp;sum(enrl_credit_campus_count) as enrl_credit_campus_count,&lt;BR /&gt;&amp;nbsp;sum(PULLM_ind) as PULLM_ind,&lt;BR /&gt;&amp;nbsp;sum(PULLM_credit_ind) as PULLM_credit_ind,&lt;BR /&gt;&amp;nbsp;sum(PULLM_credit_hours) as PULLM_credit_hours,&lt;BR /&gt;&amp;nbsp;/* ... more fields */&lt;BR /&gt;from source.student_campus_fte&lt;BR /&gt;group by snapshot,&lt;BR /&gt;&amp;nbsp;strm,&lt;BR /&gt;&amp;nbsp;acad_career&lt;BR /&gt;&amp;nbsp;;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create table student_campus_fte_d as&lt;BR /&gt;select&lt;BR /&gt;&amp;nbsp;c.*&lt;BR /&gt;from student_campus_fte_c c&lt;BR /&gt;full join student_campus_fte_w w&lt;BR /&gt;on c.snapshot = w.snapshot&lt;BR /&gt;and c.strm = w.strm&lt;BR /&gt;and c.acad_career = w.acad_career&lt;BR /&gt;where &lt;BR /&gt;&amp;nbsp;abs(c.enrl_credit_campus_count - w.enrl_credit_campus_count) &amp;gt; 0.000001 or&lt;BR /&gt;&amp;nbsp;abs(c.PULLM_ind - w.PULLM_ind) &amp;gt; 0.00001 or&lt;BR /&gt;&amp;nbsp;abs(c.PULLM_credit_ind - w.PULLM_credit_ind) &amp;gt; 0.000001 or&lt;BR /&gt;&amp;nbsp;abs(c.PULLM_credit_hours - w.PULLM_credit_hours) &amp;gt; 0.000001 or&lt;BR /&gt;&amp;nbsp;/* ... more fields */&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;BR /&gt;/*proc print data=student_campus_fte_d;*/&lt;BR /&gt;/*run;*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...of course I am open to using a different type of proc / data step, I am just looking for Ideas how I might automate this and not write the same three proc sql's with nothing but the table name, (number of fields), field names and alias's changing.&lt;STRONG&gt; Sorry I am not adding sample data&lt;/STRONG&gt; in this case all obs results are summery counts other than the control group data: like census, eot, ceneot, and fall17, fall16, spring18.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Thank you -Keith&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2018 21:06:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Best-way-to-compare-summery-data-sets-in-different-DB-my/m-p/427307#M27530</guid>
      <dc:creator>kjohnsonm</dc:creator>
      <dc:date>2018-01-12T21:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to compare summery data sets in different DB? (my starting point is 3 proc sql... w/ 'a</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Best-way-to-compare-summery-data-sets-in-different-DB-my/m-p/427308#M27531</link>
      <description>&lt;P&gt;PS&amp;nbsp;I&amp;nbsp;am not wedded to the idea of a 'proc SQL w/ full join', so chime in if there are better ways to do this... but in this case the control groups per table are relatively small.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2018 18:12:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Best-way-to-compare-summery-data-sets-in-different-DB-my/m-p/427308#M27531</guid>
      <dc:creator>kjohnsonm</dc:creator>
      <dc:date>2018-01-12T18:12:44Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to compare summery data sets in different DB? (my starting point is 3 proc sql... w/ 'a</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Best-way-to-compare-summery-data-sets-in-different-DB-my/m-p/427353#M27533</link>
      <description>Can you fix your query to make it legible?</description>
      <pubDate>Fri, 12 Jan 2018 20:34:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Best-way-to-compare-summery-data-sets-in-different-DB-my/m-p/427353#M27533</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-12T20:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to compare summery data sets in different DB? (my starting point is 3 proc sql... w/ 'a</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Best-way-to-compare-summery-data-sets-in-different-DB-my/m-p/427458#M27535</link>
      <description>&lt;P&gt;My feeling is this should be fairly doable:&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;1. Create a control table with the character (group by) variables, and the quantitative (sum) variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Create a macro that does pretty much what you're showing, except use PROC COMPARE to do your comparison.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. Have a DATA _NULL_ step that reads your control data, and sets up three strings that look like&lt;BR /&gt;"w_snapshot as snapshot, strm, acad_career,"&lt;BR /&gt;"sum(W_ENRL_CRD_CNT) as enrl_credit_campus_count, sum(W_PL_IND) as PULLM_ind, sum(W_PL_CRD_IND) as PULLM_credit_ind, sum(W_PL_CRD_HOUR) as PULLM_credit_hours,"&lt;BR /&gt;"w_snapshot, strm, acad_career"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4. Set up a macro call that includes those three strings, along with the two incoming table names, and do a "CALL EXECUTE" with that macro call.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest you start small; i) get the basic code working, no macro, no "call execute". ii) set up a macro, and get one example working. iii) expand to the call execute.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Sat, 13 Jan 2018 18:22:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Best-way-to-compare-summery-data-sets-in-different-DB-my/m-p/427458#M27535</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2018-01-13T18:22:09Z</dc:date>
    </item>
  </channel>
</rss>

