<?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: Comparison of two SAS libraries. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-two-SAS-libraries/m-p/391485#M94021</link>
    <description>&lt;P&gt;You say that you want to copy data sets to a third library when the number of datasets matches in two different libraries. The number of data sets would not be a guarantee that the sets are the same as the sets could have different names. Even if the names of the sets are the same they could be different based on numbers or names of variables or simply number of records in the same-named set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may want to be more precise describing the actual purpose of this process.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Aug 2017 14:27:43 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-08-29T14:27:43Z</dc:date>
    <item>
      <title>Comparison of two SAS libraries.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-two-SAS-libraries/m-p/391473#M94014</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have two sas libraries which I want to compare:&lt;BR /&gt;Assume &lt;BR /&gt;Library1: input&lt;BR /&gt;Library2: output&lt;/P&gt;
&lt;P&gt;I need to put a validation where I need to compare these two libraries and check whether they have same no of datasets. If the number is same I have to copy datasets from output into a third library.&lt;/P&gt;
&lt;P&gt;If the datasets are not same I have to get all the "uncommon" datasets in a variable and print it the log.&lt;/P&gt;
&lt;P&gt;Please suggest a way for such comparison.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2017 13:36:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-two-SAS-libraries/m-p/391473#M94014</guid>
      <dc:creator>Aditi24</dc:creator>
      <dc:date>2017-08-29T13:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of two SAS libraries.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-two-SAS-libraries/m-p/391484#M94020</link>
      <description>&lt;P&gt;Interesting task. Seems a bit strange to assume that the same number of members implies that the same members are in both libraries. The following steps extract the member names from sashelp.vtable and print the uncommon members in the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;      proc sql noprint;
         create table work.input as
            select MemName
               from sashelp.vtable
                  where libname = 'INPUT'
         ;
         create table work.output as
            select  MemName
               from sashelp.vtable
                  where libname = 'OUTPUT'
         ;
      quit;

      data work.compared;
         merge work.input(in= ininput) work.output(in= inOutput);
         by MemName;

         if sum(of in:) = 1;

         put MemName;
      run;&lt;/CODE&gt; &lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2017 14:31:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-two-SAS-libraries/m-p/391484#M94020</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2017-08-29T14:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of two SAS libraries.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-two-SAS-libraries/m-p/391485#M94021</link>
      <description>&lt;P&gt;You say that you want to copy data sets to a third library when the number of datasets matches in two different libraries. The number of data sets would not be a guarantee that the sets are the same as the sets could have different names. Even if the names of the sets are the same they could be different based on numbers or names of variables or simply number of records in the same-named set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may want to be more precise describing the actual purpose of this process.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2017 14:27:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-two-SAS-libraries/m-p/391485#M94021</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-08-29T14:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of two SAS libraries.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-two-SAS-libraries/m-p/391492#M94023</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro _lets_compare(lib1=,lib2=, lib3=);

 /*count the datasets and check if number of datasets are equal*/
   proc sql ; 
		select count(*) into : cnt_lib1_dtst
		from dictionary.tables 
		where libname = upcase("&amp;amp;lib1");
   quit; 
   proc sql ;
		select count(*) into : cnt_lib2_dtst
		from dictionary.tables 
		where libname = upcase("&amp;amp;lib2");
   quit; 
   
   %if &amp;amp;cnt_lib1_dtst ne &amp;amp;cnt_lib2_dtst %then %do ; 
		%put %str("the count of datasets not matched");
		title "datasets in &amp;amp;lib1 but not in &amp;amp;lib2"; 
		proc sql ; 	
			select memname
			from dictionary.tables 
			where libname = upcase("&amp;amp;lib1")
			except 
			select memname
			from dictionary.tables 
			where libname = upcase("&amp;amp;lib2");
		quit; 
		
		title "datasets in &amp;amp;lib2 but not in &amp;amp;lib1"; 
		proc sql ; 	
			select memname
			from dictionary.tables 
			where libname = upcase("&amp;amp;lib2")
			except 
			select memname
			from dictionary.tables 
			where libname = upcase("&amp;amp;lib1");
		quit; 
   %end;
   %else %do ; 
		%put %str("the count of datasets matched");
   %end; 
   
   /* copy the datasets into third library */ 
   
   proc copy in = &amp;amp;lib2 out= &amp;amp;lib3 ;
   run;
   
%mend _lets_compare ; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Aug 2017 14:38:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-two-SAS-libraries/m-p/391492#M94023</guid>
      <dc:creator>cpagrawal</dc:creator>
      <dc:date>2017-08-29T14:38:57Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of two SAS libraries.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-two-SAS-libraries/m-p/391886#M94211</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/36707"&gt;@cpagrawal&lt;/a&gt;: I need to print the unmatched datasets as well.Please help.</description>
      <pubDate>Wed, 30 Aug 2017 15:05:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-two-SAS-libraries/m-p/391886#M94211</guid>
      <dc:creator>Aditi24</dc:creator>
      <dc:date>2017-08-30T15:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of two SAS libraries.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-two-SAS-libraries/m-p/392117#M94291</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/55268"&gt;@Aditi24&lt;/a&gt;Can you please write your requirement again please ?&amp;nbsp;&lt;BR /&gt;if you can give the following a try may be it will help you.&amp;nbsp;&lt;BR /&gt;&lt;A href="https://www.mwsug.org/proceedings/2011/appdev/MWSUG-2011-AD09.pdf" target="_blank"&gt;https://www.mwsug.org/proceedings/2011/appdev/MWSUG-2011-AD09.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 09:20:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-two-SAS-libraries/m-p/392117#M94291</guid>
      <dc:creator>cpagrawal</dc:creator>
      <dc:date>2017-08-31T09:20:39Z</dc:date>
    </item>
  </channel>
</rss>

