<?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: sas proc compare in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/sas-proc-compare/m-p/530620#M145133</link>
    <description>&lt;P&gt;Thank you. Your suggestion help me resolve the problem.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 28 Jan 2019 13:35:44 GMT</pubDate>
    <dc:creator>mauri0623</dc:creator>
    <dc:date>2019-01-28T13:35:44Z</dc:date>
    <item>
      <title>sas proc compare</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-proc-compare/m-p/529823#M144823</link>
      <description>&lt;P&gt;I have a bunch of sas program in one folder and a bunch in another folder, for example folder a located at /saswork/imatemp/a and folder b at /saswork0/output/b. I want a proc compare that compares the contents of a and b and tell me what is in a that is not in b and visa versa. Thank you for all the help that you can provide.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 19:42:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-proc-compare/m-p/529823#M144823</guid>
      <dc:creator>mauri0623</dc:creator>
      <dc:date>2019-01-24T19:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: sas proc compare</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-proc-compare/m-p/529828#M144825</link>
      <description>&lt;P&gt;See this program here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=n0js70lrkxo6uvn1fl4a5aafnlgt.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=n0js70lrkxo6uvn1fl4a5aafnlgt.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Run it once for one folder and capture the data into a data set&lt;/P&gt;
&lt;P&gt;2. Run it again for your second folder&lt;/P&gt;
&lt;P&gt;3. Run PROC COMPARE on output from 1 vs 2.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This assumes you're looking for differences such as folder a has Program ABSC.sas&amp;nbsp;while folder b does not.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another quick way is as follows, assuming windows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   Filename filelist pipe "dir /b /s c:\temp\*.sas"; 
                                                                                   
   Data fileA;                                        
     Infile filelist truncover;
     Input filename $100.;
     Put filename=;
   Run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Replace the path C:\temp with your own path.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 19:52:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-proc-compare/m-p/529828#M144825</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-24T19:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: sas proc compare</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-proc-compare/m-p/529831#M144827</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run this macro to find the list of .sas file in a folder or sub-folder for path 'a' and path 'b'. After creating the two datasets you can use proc compare or proc sql (except) to find the file that are missing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: This is for Unix/Linux, if your running it in Windows then you might need to change the '/' to '\' in the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro Files_List(dsn, /* Output Dataset name. &amp;lt;libref&amp;gt;.&amp;lt;dataset name&amp;gt; e.g: Work.Files        */
			      dir, /* Directory name(Unix/Linux only). For windows need to change slashes */
			      ext  /* File extension  for search without period. i.e: sas or xlsx or txt  */  
				);   
   %if %sysfunc(exist(&amp;amp;dsn))=0 %then %do;

	/* Create a table */
		proc sql;
		create table &amp;amp;dsn  
				( File_Name char(1000) format=$1000. 
				);
		quit;

   %end;
 
  %local filrf rc did memcnt name i;                                                                                                    
                                                                                                                                        
  /* Assigns a fileref to the directory and opens the directory */                                                           
  %let rc=%sysfunc(filename(filrf,&amp;amp;dir));                                                                                               
  %let did=%sysfunc(dopen(&amp;amp;filrf));                                                                                                     
  /* Make sure directory can be open */                                                                                                 
  %if &amp;amp;did eq 0 %then %do;                                                                                                              
   %put Directory &amp;amp;dir cannot be open or does not exist;                                                                                
   %return;                                                                                                                             
  %end;                                                                                                                                 
                                                                                                                                        
   /* Loops through entire directory */                                                                                                 
   %do i = 1 %to %sysfunc(dnum(&amp;amp;did));                                                                                                  
                                                                                                                                        
     /* Retrieve name of each file */                                                                                                   
     %let name=%qsysfunc(dread(&amp;amp;did,&amp;amp;i));                                                                                               
                                                                                                                                        
     /* Checks to see if the extension matches the parameter value */                                                                   
     /* If condition is true print the full name to the log        */                                                                   
      %if %qupcase(%qscan(&amp;amp;name,-1,.)) = %upcase(&amp;amp;ext) %then %do; 
     /* Insert directory path name into table */
		proc sql;
		insert into &amp;amp;dsn
			set File_Name= "&amp;amp;dir/&amp;amp;name";
		quit;
      %end;                                                                                                                             
     /* If directory name call macro again */                                                                                           
      %else %if %qscan(&amp;amp;name,2,.) = %then %do;                                                                                          
        %Files_List(&amp;amp;dsn,&amp;amp;dir/%unquote(&amp;amp;name),&amp;amp;ext)                                                                                               
      %end;                                                                                                                             
                                                                                                                                        
   %end;   

                                                                                                                                        
  /* Closes the directory and clear the fileref */                                                                                      
  %let rc=%sysfunc(dclose(&amp;amp;did));                                                                                                       
  %let rc=%sysfunc(filename(filrf));                                                                                                    
                                                                                                                                        
%mend Files_List; 

/* Invoke the macro, example */
/*%Files_List(work.test,/home/kiran,sas);*/ &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 24 Jan 2019 19:56:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-proc-compare/m-p/529831#M144827</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2019-01-24T19:56:56Z</dc:date>
    </item>
    <item>
      <title>Re: sas proc compare</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-proc-compare/m-p/530620#M145133</link>
      <description>&lt;P&gt;Thank you. Your suggestion help me resolve the problem.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jan 2019 13:35:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-proc-compare/m-p/530620#M145133</guid>
      <dc:creator>mauri0623</dc:creator>
      <dc:date>2019-01-28T13:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: sas proc compare</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-proc-compare/m-p/530621#M145134</link>
      <description>&lt;P&gt;Thank you. Great technique. This solved my problem.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jan 2019 13:36:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-proc-compare/m-p/530621#M145134</guid>
      <dc:creator>mauri0623</dc:creator>
      <dc:date>2019-01-28T13:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: sas proc compare</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-proc-compare/m-p/530835#M145186</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/83078"&gt;@SuryaKiran&lt;/a&gt;&amp;nbsp;SAS really needs to provide functions to create data sets and add data so this kind of macros can run without generating any code.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jan 2019 03:04:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-proc-compare/m-p/530835#M145186</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-01-29T03:04:26Z</dc:date>
    </item>
  </channel>
</rss>

