<?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: Compare contents of two datasets in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Compare-contents-of-two-datasets/m-p/289018#M59604</link>
    <description>&lt;P&gt;Hi Suzanne,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tha code simply renames your variables into &lt;STRONG&gt;site1_1&lt;/STRONG&gt; (the first variable&amp;nbsp; from your first dataset, in the order you listed in varnames: &lt;STRONG&gt;%let varnames=age height weight;&lt;/STRONG&gt;), &lt;STRONG&gt;site1_2&lt;/STRONG&gt; ( the second variable&amp;nbsp; from your first dataset),... &lt;STRONG&gt;site1_n&lt;/STRONG&gt;, &lt;STRONG&gt;site2_1&lt;/STRONG&gt;, etc.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assumed that you want to do a difference between the two tables (&lt;STRONG&gt;diff&amp;amp;i. = sum (site1_&amp;amp;i, -site2_&amp;amp;i);&lt;/STRONG&gt;) which was the reason I renamed the variables in the first place.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If that's the case, to use that code do the following:&lt;/P&gt;&lt;P&gt;1) in &lt;STRONG&gt;%let varnames=age height weight;&lt;/STRONG&gt; replace &lt;STRONG&gt;age, height, weight&lt;/STRONG&gt; with your variables from the two datasets.&lt;/P&gt;&lt;P&gt;2) name your datasets &lt;STRONG&gt;site1&lt;/STRONG&gt; and &lt;STRONG&gt;site2&lt;/STRONG&gt; (or change their name when you call the macro &lt;STRONG&gt;xxx&lt;/STRONG&gt;).&lt;/P&gt;&lt;P&gt;3) replace &lt;STRONG&gt;by name&lt;/STRONG&gt; with &lt;STRONG&gt;by (your list of unique identifiers).&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;</description>
    <pubDate>Tue, 02 Aug 2016 21:09:08 GMT</pubDate>
    <dc:creator>DeaT</dc:creator>
    <dc:date>2016-08-02T21:09:08Z</dc:date>
    <item>
      <title>Compare contents of two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Compare-contents-of-two-datasets/m-p/288185#M59573</link>
      <description>&lt;P&gt;Hi-&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Asking this super SAS support group for some help.&amp;nbsp; I am trying to compare the contents (data) from two different datasets.&amp;nbsp; Both have the same variable names but&amp;nbsp;the number of observations differ.&amp;nbsp; I tried proc compare to compare to obtain differences but it was difficult to interpret the proc compare results.&amp;nbsp; Can anyone help me on how I can go about producing an outpuf file upon comparing patient information from both datasets.&amp;nbsp; It would be helpful if the output&amp;nbsp;would contain only patient data from&amp;nbsp;from table A not matching patient data in table B.&amp;nbsp;&amp;nbsp; Any help would be appreciated.&amp;nbsp; Thank you all in advance!&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2016 17:18:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Compare-contents-of-two-datasets/m-p/288185#M59573</guid>
      <dc:creator>SannaSanna</dc:creator>
      <dc:date>2016-07-29T17:18:06Z</dc:date>
    </item>
    <item>
      <title>Re: Compare contents of two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Compare-contents-of-two-datasets/m-p/288187#M59575</link>
      <description>&lt;P&gt;Proc compare has it's limitations. A simple SQL query will generate what you want, the code below will select observations from TableA where the ID is not in TableB. You can replace the ID variable by your ID variable and table name with your table names.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table missing as
select * from tableA
where ID not in (select distinct ID from tableB);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Can you have multiple records per patient? How should that be handled?&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2016 17:20:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Compare-contents-of-two-datasets/m-p/288187#M59575</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-07-29T17:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: Compare contents of two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Compare-contents-of-two-datasets/m-p/288191#M59576</link>
      <description>&lt;P&gt;Hi-&amp;nbsp; Thank you so much for responding in my quest for help!!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes.&amp;nbsp; There could be multiple records per patient and the patient record data&amp;nbsp;could be reported&amp;nbsp;from different location sites.&amp;nbsp; I want to compare the patient data at location ABC from Table A against the same patient data at location XYZ from Table B.&amp;nbsp;&amp;nbsp; Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2016 17:25:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Compare-contents-of-two-datasets/m-p/288191#M59576</guid>
      <dc:creator>SannaSanna</dc:creator>
      <dc:date>2016-07-29T17:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: Compare contents of two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Compare-contents-of-two-datasets/m-p/288966#M59593</link>
      <description>&lt;P&gt;Maybe not very elegant, but this should do the trick.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/* Get some dummy data. */&lt;BR /&gt;%let varnames=age height weight;&lt;BR /&gt;&lt;BR /&gt;data site1;&lt;BR /&gt;set sashelp.class;&lt;BR /&gt;age = age +1;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data site2;&lt;BR /&gt;set sashelp.class;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/* Rename your variables. */&lt;BR /&gt;%macro xxx (site);&lt;BR /&gt;&lt;BR /&gt;proc datasets library=work memtype=data nolist;&lt;BR /&gt;&amp;nbsp;modify &amp;amp;site.;&lt;BR /&gt;&amp;nbsp;rename&lt;BR /&gt;&amp;nbsp;%do i=1 %to %sysfunc(countw(&amp;amp;varnames));&lt;BR /&gt;&amp;nbsp; %scan(&amp;amp;varnames,&amp;amp;i)= &amp;amp;site._&amp;amp;i&lt;BR /&gt;&amp;nbsp;%end;&lt;BR /&gt;&amp;nbsp;;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;%mend xxx;&lt;BR /&gt;&lt;BR /&gt;%xxx (site1);&lt;BR /&gt;%xxx (site2);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/* Comparison. */&lt;BR /&gt;%macro yyy;&lt;BR /&gt;&lt;BR /&gt;data comp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;merge site1 (in = a) site2 (in = b);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;by name ; /* plus any other unique keys you may have */&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if a and b then flag =&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Site 1 &amp;amp; 2 ";&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;else if a and not b then flag = "Site 1 only";&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;else if not a and b then flag = "Site 2 only";&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;%do i=1 %to %sysfunc(countw(&amp;amp;varnames));&lt;BR /&gt;&amp;nbsp;&amp;nbsp; diff&amp;amp;i. = sum (site1_&amp;amp;i, -site2_&amp;amp;i);&lt;BR /&gt;&amp;nbsp;%end;&lt;BR /&gt;&lt;BR /&gt;run;&lt;BR /&gt;%mend yyy;&lt;BR /&gt;&lt;BR /&gt;%yyy;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2016 16:26:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Compare-contents-of-two-datasets/m-p/288966#M59593</guid>
      <dc:creator>DeaT</dc:creator>
      <dc:date>2016-08-02T16:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: Compare contents of two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Compare-contents-of-two-datasets/m-p/288969#M59595</link>
      <description>&lt;P&gt;Thank you for your response.&amp;nbsp; I'm not too versed with macros but I'll pull my reference books out to review again.&amp;nbsp;&amp;nbsp; Do you know if the SQL stmts below&amp;nbsp;would work?&amp;nbsp;&amp;nbsp; To get the differences and then another pass to get the intersects/commons?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc SQL;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; create table missing as&lt;/P&gt;
&lt;P&gt;&amp;nbsp; select * from Tab1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except&lt;/P&gt;
&lt;P&gt;&amp;nbsp;select * from Tab2;&lt;/P&gt;
&lt;P&gt;Quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc SQL;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; create table missing as&lt;/P&gt;
&lt;P&gt;&amp;nbsp; select * from Tab1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; intersect&lt;/P&gt;
&lt;P&gt;&amp;nbsp;select * from Tab2;&lt;/P&gt;
&lt;P&gt;Quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2016 16:42:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Compare-contents-of-two-datasets/m-p/288969#M59595</guid>
      <dc:creator>SannaSanna</dc:creator>
      <dc:date>2016-08-02T16:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: Compare contents of two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Compare-contents-of-two-datasets/m-p/288978#M59596</link>
      <description>&lt;P&gt;Hi-&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your help.&amp;nbsp; I am trying to compare 15 variables from Tab1 and Tab2.&amp;nbsp;&amp;nbsp; Can you help explain what this part of your code does.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/* Rename your variables. */&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; xxx (site);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;proc datasets library=work memtype=data nolist;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; modify &amp;amp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;site.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;rename&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%do&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; i=&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%to&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%sysfunc&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;(countw(&amp;amp;varnames));&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%scan&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;(&amp;amp;varnames,&amp;amp;i)= &amp;amp;site._&amp;amp;i&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%end&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; xxx;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;xxx&lt;/I&gt;&lt;/STRONG&gt; (site1);&lt;/P&gt;
&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;xxx&lt;/I&gt;&lt;/STRONG&gt; (site2);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2016 17:50:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Compare-contents-of-two-datasets/m-p/288978#M59596</guid>
      <dc:creator>SannaSanna</dc:creator>
      <dc:date>2016-08-02T17:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: Compare contents of two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Compare-contents-of-two-datasets/m-p/288982#M59597</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12130"&gt;@SannaSanna﻿&lt;/a&gt;&amp;nbsp;Did you try the initial code I suggested?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2016 18:11:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Compare-contents-of-two-datasets/m-p/288982#M59597</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-02T18:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: Compare contents of two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Compare-contents-of-two-datasets/m-p/288986#M59598</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes I did. &amp;nbsp;Unfortunately it didnt work. &amp;nbsp;I think its because I have duplicate IDs (which is valid for my dataset) But I dont think SAS liked it. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2016 18:19:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Compare-contents-of-two-datasets/m-p/288986#M59598</guid>
      <dc:creator>SannaSanna</dc:creator>
      <dc:date>2016-08-02T18:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: Compare contents of two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Compare-contents-of-two-datasets/m-p/288987#M59599</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12130"&gt;@SannaSanna&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi Reeza,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes I did. &amp;nbsp;Unfortunately it didnt work. &amp;nbsp;I think its because I have duplicate IDs (which is valid for my dataset) But I dont think SAS liked it. &amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12130"&gt;@SannaSanna&lt;/a&gt;&amp;nbsp;Duplicate ID's shouldn't have mattered, did you get an error or results that were unsatisfactory?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2016 18:25:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Compare-contents-of-two-datasets/m-p/288987#M59599</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-02T18:25:41Z</dc:date>
    </item>
    <item>
      <title>Re: Compare contents of two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Compare-contents-of-two-datasets/m-p/289004#M59602</link>
      <description>&lt;P&gt;Hi Reeza,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you so much for your help.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;** trying to compare Table A with Table B to determine contents in Table A changed/missing in Table B and produce output for additional review**&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the code I applied which you suggested.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;create&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;table&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; missing &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;as&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;select&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; * &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;from&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; TABLEA&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;where&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; PATIENTID LOCATION DATE PROC OUTCOME&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;not&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;in&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;select&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;distinct&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; PATIENTID LOCATION DATE PROC OUTCOME &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;from&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; TABLEB);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;Syntax error after PatientID&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;ERROR 22-322: Syntax error, expecting one of the following: ;, !, !!, &amp;amp;, (, *, **, +, -, '.', /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, ?, AND, BETWEEN, CONTAINS, EQ, EQT, EXCEPT, GE, GET, GROUP, GT, GTT, HAVING, IN,&lt;/P&gt;
&lt;P&gt;INTERSECT, IS, LE, LET, LIKE, LT, LTT, NE, NET, NOT, NOTIN, OR, ORDER, OUTER, UNION, ^, ^=, |, ||, ~, ~=.&lt;/P&gt;
&lt;P&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2016 19:49:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Compare-contents-of-two-datasets/m-p/289004#M59602</guid>
      <dc:creator>SannaSanna</dc:creator>
      <dc:date>2016-08-02T19:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: Compare contents of two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Compare-contents-of-two-datasets/m-p/289018#M59604</link>
      <description>&lt;P&gt;Hi Suzanne,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tha code simply renames your variables into &lt;STRONG&gt;site1_1&lt;/STRONG&gt; (the first variable&amp;nbsp; from your first dataset, in the order you listed in varnames: &lt;STRONG&gt;%let varnames=age height weight;&lt;/STRONG&gt;), &lt;STRONG&gt;site1_2&lt;/STRONG&gt; ( the second variable&amp;nbsp; from your first dataset),... &lt;STRONG&gt;site1_n&lt;/STRONG&gt;, &lt;STRONG&gt;site2_1&lt;/STRONG&gt;, etc.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assumed that you want to do a difference between the two tables (&lt;STRONG&gt;diff&amp;amp;i. = sum (site1_&amp;amp;i, -site2_&amp;amp;i);&lt;/STRONG&gt;) which was the reason I renamed the variables in the first place.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If that's the case, to use that code do the following:&lt;/P&gt;&lt;P&gt;1) in &lt;STRONG&gt;%let varnames=age height weight;&lt;/STRONG&gt; replace &lt;STRONG&gt;age, height, weight&lt;/STRONG&gt; with your variables from the two datasets.&lt;/P&gt;&lt;P&gt;2) name your datasets &lt;STRONG&gt;site1&lt;/STRONG&gt; and &lt;STRONG&gt;site2&lt;/STRONG&gt; (or change their name when you call the macro &lt;STRONG&gt;xxx&lt;/STRONG&gt;).&lt;/P&gt;&lt;P&gt;3) replace &lt;STRONG&gt;by name&lt;/STRONG&gt; with &lt;STRONG&gt;by (your list of unique identifiers).&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2016 21:09:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Compare-contents-of-two-datasets/m-p/289018#M59604</guid>
      <dc:creator>DeaT</dc:creator>
      <dc:date>2016-08-02T21:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: Compare contents of two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Compare-contents-of-two-datasets/m-p/289037#M59605</link>
      <description>&lt;P&gt;Hi-&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think I almost got it to run correctly.&amp;nbsp; The code failed untimately.&amp;nbsp;&amp;nbsp; The comparison code-&amp;nbsp; why is my data being converted from Character to Numeric?&amp;nbsp;&amp;nbsp;&amp;nbsp; The data contents within TableA and TableB are all string/characters/YN and no numeric.&amp;nbsp; And does the data need to be sorted first in the merge step?&amp;nbsp; &amp;lt;&amp;lt; got error message too&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2016 22:10:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Compare-contents-of-two-datasets/m-p/289037#M59605</guid>
      <dc:creator>SannaSanna</dc:creator>
      <dc:date>2016-08-02T22:10:40Z</dc:date>
    </item>
  </channel>
</rss>

