<?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: Check if two datasets are the same in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Check-if-two-datasets-are-the-same/m-p/230060#M41700</link>
    <description>&lt;P&gt;Maybe I was a bit unclear, I&amp;nbsp;want to compare whole datasets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset generated by a script,&lt;/P&gt;&lt;P&gt;it should replace an existing dataset if the contents of those two are different.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need a function or procedure which works like %sysfunc(exist(dataset)) which returns a boolean value (true, false) which can be used in an if-Statement.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Oct 2015 12:07:31 GMT</pubDate>
    <dc:creator>helmma</dc:creator>
    <dc:date>2015-10-15T12:07:31Z</dc:date>
    <item>
      <title>Check if two datasets are the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-if-two-datasets-are-the-same/m-p/230043#M41690</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 2 datasets, how can I compare if they are the same. I am searching for a function that returns true or false&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2015 10:03:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-if-two-datasets-are-the-same/m-p/230043#M41690</guid>
      <dc:creator>helmma</dc:creator>
      <dc:date>2015-10-15T10:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: Check if two datasets are the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-if-two-datasets-are-the-same/m-p/230044#M41691</link>
      <description>&lt;P&gt;Use Proc Compare:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data A B;&lt;BR /&gt;&amp;nbsp; Do i=1 To 10;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Output;&lt;BR /&gt;&amp;nbsp; End;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;Data C;&lt;BR /&gt;&amp;nbsp; Do i=2 To 12;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Output;&lt;BR /&gt;&amp;nbsp; End;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;Proc Compare Base=A Comp=B; Run;&lt;BR /&gt;Proc Compare Base=A Comp=C; Run;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2015 10:10:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-if-two-datasets-are-the-same/m-p/230044#M41691</guid>
      <dc:creator>user24feb</dc:creator>
      <dc:date>2015-10-15T10:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: Check if two datasets are the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-if-two-datasets-are-the-same/m-p/230057#M41698</link>
      <description>&lt;P&gt;&lt;STRONG&gt;PROC COMPARE &lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;compares two data sets: the &lt;SPAN class="strong"&gt;base data set&lt;/SPAN&gt; and the &lt;SPAN class="strong"&gt;comparison data set&lt;/SPAN&gt;. The procedure determines matching variables and matching observations. &lt;SPAN class="strong"&gt;Matching variables&lt;/SPAN&gt; are variables with the same name or variables that you pair by using the VAR and WITH statements. Matching variables must be of the same type. &lt;SPAN class="strong"&gt;Matching observations&lt;/SPAN&gt;are observations that have the same values for all ID variables that you specify or, if you do not use the ID statement, that occur in the same position in the data sets. If you match observations by ID variables, then both data sets must be sorted by all ID variables.&lt;/P&gt;
&lt;PRE&gt;proc compare base=proclib.one
             compare=proclib.two novalues;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;COMPARE Function&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Returns the position of the leftmost character by which two strings differ, or returns 0 if there is no difference.&lt;/P&gt;
&lt;PRE&gt;data test2;
   pad1=compare('abc','abc            ');   
   pad2=compare('abc','abcdef         ');   
   truncate1=compare('abc','abcdef',':');  
   truncate2=compare('abcdef','abc',':');  
   blank=compare('','abc',          ':');   
run;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Oct 2015 11:52:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-if-two-datasets-are-the-same/m-p/230057#M41698</guid>
      <dc:creator>anitapamu2</dc:creator>
      <dc:date>2015-10-15T11:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: Check if two datasets are the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-if-two-datasets-are-the-same/m-p/230060#M41700</link>
      <description>&lt;P&gt;Maybe I was a bit unclear, I&amp;nbsp;want to compare whole datasets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset generated by a script,&lt;/P&gt;&lt;P&gt;it should replace an existing dataset if the contents of those two are different.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need a function or procedure which works like %sysfunc(exist(dataset)) which returns a boolean value (true, false) which can be used in an if-Statement.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2015 12:07:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-if-two-datasets-are-the-same/m-p/230060#M41700</guid>
      <dc:creator>helmma</dc:creator>
      <dc:date>2015-10-15T12:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: Check if two datasets are the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-if-two-datasets-are-the-same/m-p/230061#M41701</link>
      <description>&lt;P&gt;Proc compare has an automatically generated&amp;nbsp;macro-variable which tells you this: &amp;amp;sysinfo. (zero means equal). (use noprint to suppress the output of proc compare).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The return codes in detail are here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a000146743.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a000146743.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.. or you could use proc sql or merge or something like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2015 12:13:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-if-two-datasets-are-the-same/m-p/230061#M41701</guid>
      <dc:creator>user24feb</dc:creator>
      <dc:date>2015-10-15T12:13:18Z</dc:date>
    </item>
  </channel>
</rss>

