|
Feature |
Description |
Metric |
|
First Digit Analysis |
Compare actual versus expected frequency of leading digit, quantify results |
Kolmogorov-Smirnov (KS) |
|
First Two Digits |
Compare actual versus expected frequency of first two digits, quantify results |
Kolmogorov-Smirnov (KS) |
|
First Three Digits |
Compare actual versus expected frequency of first three digits, quantify results |
Kolmogorov-Smirnov (KS) |
|
Second Digit |
Compare actual versus expected frequency of the second digit |
Kolmogorov-Smirnov (KS) |
|
Last Two digits of three |
Of the first three digits, obtain the distribution of the last two digits of the three |
Kolmogorov-Smirnov (KS) |
|
Last Digit |
The last or right most digit |
Kolmogorov-Smirnov (KS) for uniform distribution |
|
Last Two digits |
The last or rightmost two digits |
Kolmogorov-Smirnov (KS) for uniform distribution |
The general syntax of the script used to accomplish the
analysis is: OPTIONS OBS=MAXRECORDS;
PROC BENFORD DATA=LIBNAME.FILENAME TEST=TESTTYPE;
VAR VARNAME;
OUT = LIBNAME.FILENAME;
Where the parameters highlighted in bold are specified as follows –
LIBNAME – the name
of the directory where the data is located
FILENAME – the base filename
(excluding the path and the extension)
VARNAME - the name of the numeric variable
being tested
TESTTYPE – the type of test being
performed, indicated by the following codes:
|
Code |
Description of Audit Test |
|
F1 |
Test of first digit |
|
F2 |
Test of first two digits |
|
F3 |
Test of first three digits |
|
L1 |
Test of the last digit |
|
L2 |
Test of the last two digits |
|
D2 |
Test of the second digit |
MAXRECORDS – the maximum number of records to be
tested (default is all if not specified)
VARNAME – the name of the numeric variable to be
tested.
Example Script
An example script to analyze the data file named /test/benford/invoices.tab, testing the two leading digits of the invoice amount and storing the results of the analysis in the file named /test/audit/report/invoicetwodigits.tab. A maximum of 10,000 records are to be processed.* run benford test on the first two digits of the PAIDAMT field;
* because this is an initial test run only, limit population to 10000 records;
LIBNAME BEN ‘/TEST/BENFORD;
LIBNAME REPORT ‘/TEST/AUDIT/REPORT’;
OPTIONS OBS=10000;
PROC BENFORD DATA=BEN.INVOICES TEST=F2;
VAR PAIDAMT;
OUT = REPORT.INVOICETWODIGITS;
