Page 1 of 1

using Compare Data tool

Posted: June 25th, 2012, 12:16 am
by vanndy
Hello,

in Compare Data tool, it shows the different data between 2data files that were compared.
How can we count the case that have different data and the same data?

Best regards,

Vanndy

Re: using Compare Data tool

Posted: June 25th, 2012, 2:33 pm
by Gregory Martin
There is no way to determine this information directly from the Compare Data tool, but you can process the Compare Data listing file and count the number of cases that had errors. You can identify these cases by searching for the [ bracket that begins a section of differences. Here is how, with a batch application, you could process this listing file:
PROC GLOBAL

file listingFile;

alpha (300) str;

PROC READCSDIFFLISTING_FF

preproc

    
numeric numDiffCases;

    
do while fileread(listingFile,str)
    
        
if pos("[",str) = 1 then // listing a new ID where there were differences
            inc(numDiffCases);
        
endif;
    
    
enddo;
    
    
errmsg("There were %d cases with differences.",numDiffCases);
If you wanted to count the cases, you could add your dictionary file as an external dictionary to this batch application and count the cases, like this:
    // count the number of cases in one of the files
    
    
numeric numCases;
    
    
while loadcase(CEN2000) do
        
inc(numCases);
    
enddo;
    
    
    
errmsg("There were %d cases (of %d) with differences, or %d%.",numDiffCases,numCases,100 * numDiffCases / numCases);
See attached for this application.