You are on page 1of 94

ACL TRAINING

Course Objectives
For the students to learn how to use ACL,
particularly the commonly used
commands and functions as well as to
create, run, update scripts/batches and
analyze the corresponding results.

Coverage

Uses of ACL
How does ACL read data?
What kinds of data can ACL read?
ACL User Working Knowledge
Navigating the ACL program window
How do I apply ACL to my project?
Organizing your project items
Viewing and modifying your tables
Organizing your work using ACL projects
ACL commands
Log file activities
Expressions
Functions
LIST command
ACL Scripts
Creation of Scripts & Sample Exercises

What can I use ACL for?

Gather essential information for effective


decision-making
Convert data types
Ensure data integrity
Process any data type
Process data rapidly
Read files of any size
Read native data types

How does ACL read data?


ACL uses tables to describe the location,
layout, and content of the source data.

Source Data

Table

View

What kinds of data can ACL read?

CR files
CR/LF files
Data sources with file layout
Data sources without file layout
Databases
Delimited files
Fixed-length files
Flat files
Hierarchical and relational databases
LF files
Mainframe databases
Multiple-record-type files
Proprietary variable-length files
Report files
Segmented files
Variable-length files

ACL User Working Knowledge


Anyone who is willing to go through the
Learning Process (Read, Listen, Watch,
and Play).
Knowledge MS Excel basic functions will
fast track the Learning Process.
Interests and knowledge in MS Excel
formulas will be an advantage in making
ACL Scripts.

Organizing your project items

Viewing and modifying your tables

Changing the columns in a view


Adding a computed value as a column
Adding a computed value as a field
Sorting a view with Quick Sort

Viewing & Modifying your tables

How do I apply ACL to my project?


1

Plan your project


Identify the objective in business and technical terms.
Determine the steps necessary to achieve the objectives
within the context of the subsequent phases.

Acquire the data


Gain physical and logical access by identifying the location
and the format of the source data that you require.

Access the data with ACL


Add the data to your project as tables, which define how
ACL reads the source data.

How do I apply ACL to my project?


4

Verify the integrity of the data


Ensure that the data does not contain corrupt elements and
that the table is properly constructed. Test for uniqueness,
data relationships, and reliability.
Analyze the data
Interrogate and manipulate the data to identify exceptions.

Report your findings


Prepare the results for formal presentation.

Plan your project


Identifying the project objectives
Identifying the technical requirements
Identifying analytical procedures

Acquire the data for your project


Guidelines for acquiring data
Request your data as either ODBC or a flat
file
Use raw data
Request a copy of the data
Request a file description or layout

Requesting files and layouts


Obtaining data from a server
Obtaining data from a PC

Access your data


Starting a new project in ACL.
Project - holder for data that you
import into ACL as tables.
Creating tables to access your data

Organizing your work using ACL projects


Tables - ACL uses tables to describe the
location, layout, and content of the source data.
Views - a window that lets you arrange the way
data in your table is displayed.
Scripts - a series of ACLScript commands that
can be executed repeatedly and automatically
within your ACL project.
Indexes - Indexes let you access the records in
your table in a specific order.
Command logs - The command log records
every command that you issue and the results of
your analysis.
Folders to organize your projects

To start a new project in ACL


Select File New Project.
Specify the location and filename for the
project file.

To add a table to your project

In the Overview, right-click the project


name and select New Table. The Data
Definition Wizard appears.
Follow the steps in the Wizard to define
your data.

Verify the integrity of your data


Counting records
Totalling numeric fields
Checking for validity errors

Verify the integrity of your data


Verify - to check for data validity errors in
the active table
Count - to count the number of records in
the current table, or only those that meet a
specified test condition
Total - to total numeric fields or
expressions in the active table

To use the Verify command


Select Data from the menu bar and
choose Verify to display the Verify dialog
box.
To use the Count command
Select Analyze from the menu bar and
choose Count Records to display the
Count dialog box.

To use the Total command


Select Analyze from the menu bar and
choose Total Fields to display the Total
dialog box.
To use the Statistics command
Select Analyze from the menu bar and
choose Statistics to display the Statistics
dialog box.

Analyze your data

Summarizing your data


Examining sequential data
Extracting and exporting records
Sorting and indexing tables
Surveying your data
Working with multiple tables
Sampling with ACL

Summarizing your data


Stratify
Use the Stratify command to count
the number of records that fall into
specified intervals or strata of
numeric field or expression values
The Stratify command works on
unsorted tables and is particularly
useful for quickly scan and
summarize

Summarizing your data


AGE
Returns the age, in days, of a specified date
compared to a specified cutoff date.
When comparing two dates to determine overdue
accounts or to perform aged analyses of
balances to produce aged summaries of data
Age counts the number of records in a table and:
Divides the records into intervals based on date or
aging periods.
Counts the number of records in each interval
Subtotals the values of one or more numeric fields for
each interval
Calculates the percent of the total count and of the
total value of a subtotaled field for each interval

Summarizing your data


CLASSIFY
To count the number of records relating to each
unique value of a character field and to subtotal
specified numeric fields for each of these unique
values
Classify works on unsorted data and is
particularly useful for quick data scanning and
summarizing.
Classify can also eliminate the need to perform
separate Sort and Summarize operations.

Summarizing your data


SUMMARIZE
Counts the records for each distinct value of
selected character or date fields and subtotals
numeric fields for each of these distinct values
Can report on a limitless number of unique key
character field values,
Use the Other Fields option to select character
or numeric fields to include in your output.
You can use Summarize to remove duplicate
records from a table.

Summarizing your data


CROSS-TABULATE
Analyze character fields by setting them in rows
and columns.
Produce various summaries, explore areas of
interest, and subtotal numeric fields
Cross-tabulate counts the number of records in
a table and:
Counts each row value within each column value
Subtotals numeric fields for each row value within
each column value
Totals the amounts for each column value

To use the Stratify command


Select Analyze from the menu bar and
choose Stratify to display the Stratify
dialog box.
To use the Classify command
Select Analyze from the menu bar and
choose Classify to display the Classify
dialog box.

To use the Cross-tabulate command


Select Analyze from the menu bar and choose
Cross-tabulate to display the Cross-tabulate
dialog box.
To use the Age command
Select Analyze from the menu bar and choose
Age to display the Age dialog box.
To use the Summarize command
On the menu bar, select Analyze Summarize
to display the Summarize dialog box.

Examining sequential data


Sequence - to determine whether key
fields in the active table are in sequential
order
Gaps - to detect gaps in the key fields of
the active table
Duplicates - detects whether key fields in
the active table contain duplicates

Examining sequential data


To use the Sequence command
Select Analyze from the menu bar and choose
Examine Sequence to display the Sequence
dialog box.
To test for gaps
Select Analyze from the menu bar and choose
Look for Gaps to display the Gaps dialog box
To test for duplicate records
Select Analyze from the menu bar and choose
Look for Duplicates to display the Duplicates
dialog box.

Extracting and exporting records


EXTRACT
To create a new table from selected fields or
records in the active table.
To reduce the table size and processing time.
To isolate unusual items in a separate table for
further analysis.
You can extract entire records from the table, or
extract specified fields from records.

Extracting and exporting records


EXPORT
To export files in a format readable by
another package.
Create files to use in:
Databases
Presentation graphics programs
Spreadsheet programs
Word processors

Sorting and indexing tables


Sort - to sort the active table into
ascending or descending order based on
specified key fields
Index - to create an index file that allows
direct access to the records of a table in a
logical rather than physical order

To use the Sort command


Select Data from the menu bar and
choose Sort Records to display the Sort
dialog box.

Surveying your data


STATISTICS
Provides a more complete overview of the
significant properties of a numeric file.
It can quickly highlight abnormalities in the
table, which can then establish a direction
for your subsequent approach or analysis.

Surveying your data


Profile
To provide summary statistics on one or more
numeric fields in a table.
Profile provides the following information for
numeric fields:

Total value
Absolute value
Minimum value
Maximum value

To determine minimum, maximum, absolute, and


total field values before issuing the Stratify,
Histogram, or Sample commands.

Surveying your data


Benford
To generate digital analysis of numeric
data by applying the Benford formula.
Benford command enable auditors and
other data analysts to focus on possible
anomalies in large data sets

Surveying your data


To use the Statistics command
From the menu, select Analyze, Statistical
then Statistics.
To use the Profile command
From the menu, select Analyze, Statistical
then Profile.
To use the Benford command
From the menu, select Analyze and click
on Perform Benford Analysis.

Working with multiple tables


Relations
To simultaneously access and analyze
data from two or more tables
Join
To combine fields from two tables into a
third table
to match records in a transaction table
with those in a master table

Working with multiple tables


Merge
To combine two sorted tables with
identical record layouts into a third table.
Extract command with the Append to
Existing Table options
To add records from the active table to the
end of another table
Can be performed on unsorted files.

Working with multiple tables


To use the Relations command
From the menu, select Data and click on Relate
Tables
To use the Join command
From the menu, select Data and click on Join
Data Files
To use the Merge command
From the menu, select Data and click on Merge
Tables
To use the Extract & Append command
Select Data, then Extract Data
On the More tab, select Append to Existing File.

MATCH()
MATCH()
MATCH( ) compares an expression or field value
of any type to a series of specified expressions
or field values to determine whether there is at
least one match. The value returned is either
true or false.
Use MATCH( ) to eliminate the need to repeat
arguments in a test.
Function format
MATCH(comparison_value, test1,test2 <,test
3...>)

MATCH()
IF LOC = 7 OR LOC = 9 OR LOC = 13 OR
LOC = 21 OR LOC = 44
can be replaced with:
IF MATCH(LOC, 7, 9, 13, 21, 44)

ACCEPT
Use ACCEPT to create an interactive
script that pauses to display a dialog box
that prompts for information that ACL uses
in subsequent processing.
Syntax
ACCEPT "message_text" <FIELDS
"list_item"> TO variable_name

OPEN
Use the OPEN command to open a table
or dBASE file or to associate source data
with a table.
Syntax
OPEN table_name

SORT
Syntax
SORT ON key_field <D>... TO table-name
<IF test> <WHILE test> <FIRST|NEXT
range> <APPEND> <OPEN>

STRING( )
converts a numeric expression or field value into a string
of characters.
Function format:
STRING(number, length <,format>)

You can specify an optional numeric format as a


third parameter to format the numerical result of
the function.
If the resulting string is shorter than length,
leading blanks are added. If the resulting string
is longer than length, leading characters are
truncated without notification starting with the
minus sign, if any.
STRING( ) is the opposite of VALUE( )

STRING( )
STRING(125.2, 7) = "
125.2"

The length of the new string is 7.


The new string consists of two
leading spaces, followed by the
original five characters.

STRING(-125.2, 4) = "25.2"

The length of the new string is 4.


The first two leading characters of
the original string have to be
truncated to make the length of the
new string equal to 4.

STRING(-125.2, 10,
"(9,999.99)") = " (125.20)"

The number format represents the


negative number by using
parentheses, instead of the
negative sign used in the original
number. The new string has two
leading spaces, and eight other
characters.

VALUE( )
converts a character expression or field
into a numeric equivalent.
returns the numeric equivalent of a
character expression or field value with a
specified number of decimal places.
if the decimal adjustment results in a loss
of decimals, the result is rounded.
Function format:
VALUE(string, decimals)

VALUE( )
Examples
VALUE("123.4-", 3) = -123.400
VALUE("$123,456", 2) = 123456.00
VALUE("77.45CR", 2) = -77.45
VALUE(" (123,456.78)", 0) = -123457

Entering commands on the command line


Enter commands in uppercase or
lowercase characters.
Enter each command on a single line.
When the command is long, ACL expands
the text box to display the entire command
You can abbreviate commands, functions,
and keywords in ACLScript

Reviewing the log of your past activities


To view the log
In the Overview, click the Log tab. ACL opens
the log.
To browse the command log
Double-click date entries to show the commands
performed during that session
To start a new session in the command log
Select Tools Add New Session. Enter a
descriptive name for the new session and click
OK

To save portions of the log to a file


On the Log tab, select the check boxes of the
sessions and commands that you want to
export. In Overview, you must double-click the
log to display it before you can select the check
boxes.
Right-click, select Save Selected Items, and
choose the file format to which you are saving
the log entries

HTML
Log File
Script
WordPad
Text

Manipulating data using expressions


Expressions let you ask questions of your
data.
They are used primarily to create filters
and computed fields.
Expressions perform calculations, specify
logical conditions for a test, or create
values that do not exist in a table

Four Types of Expressions


Character expressions
Ex. City = "Paris"
Numeric expressions
Ex. Amount + 1
Logical expressions
Ex. Amount > 1
Date expressions
Ex. Date = `20001231`

Limiting the scope of a command


First lets you specify the number of
records to be processed, starting from the
beginning of the table
Next lets you specify the number of
records to be processed, starting from the
current position in the table
If statements allow a command to process
records based on a logical test
While statements allow a command to
process records until a logical test fails

Choosing the type of command output


Screen. The results are displayed as a
table in the results window
Graph. The results are displayed as a
graph in the results window
File. The results are saved in a file or
table
Print. The results are sent to the default
printer

Using functions to build advanced


expressions
Functions
are sophisticated analytical routines that allow
you to perform a wide range of computational
and data manipulation tasks
are usually used in expressions to create
computed fields or tests for filtering records

Eight Categories of Functions

Data conversion STRING(), VAL()


Date and time AGE(), CTOD(), CDOW()
Bit/character ASCII()
Financial RATE()
Logical MATCH(), VERIFY()
Mathematical MAXIMUM(), MINIMUM()
String access SUBSTRING(), UPPER()
Miscellaneous RECNO()

AGE( )
returns the age, in days, of a specified
date compared to a specified cutoff date.
when comparing two dates to determine
overdue accounts or to perform aged
analyses of balances.
Function format:
AGE(date <,cutoff_date_yyyymmdd>)

AGE( )
Examples
Current system date of January 1, 1996:
AGE(`951220`) = 12
AGE(`19960108`) = -7
AGE(`19941220`,`950101`) = 12
AGE(Invoice_date) = 65
AGE(Invoice_date,`961231`) = 80
To extract the name, amount, and invoice date for
all items more than 180 days old:
AGE(Invoice_date,`961231`) > 180

CTOD( )
converts a character or numeric
expression into a valid date expression
to create a date for purposes of
comparison with date field values,
especially if the date is not a constant
short for Character To Date
Function format:
CTOD(field <,"date_format">)

CTOD( )
Examples:
1. Due < CTOD(950701)
2. CTOD("951231")
3. CTOD(311295,"DDMMYY")
4. CTOD("19951231")
5. CTOD("951231", "YYMMDD")
6. CTOD("311295", "DDMMYY")
7. CTOD(951231)
8. CTOD(95365, "YYDDD")
9. CTOD("31/12/1995", "DD/MM/YYYY")
10.CTOD("951220") = "12/20/95"
11.CTOD("DEC2095","MMMDDYY") = "12/20/95"

SUBSTRING( )
returns a substring of a character
expression or field value
to isolate a portion of a character
expression or field value
Function format:
SUBSTRING(string, start, length)
start specifies the start position in string.
length specifies the length of the result in
characters.

SUBSTRING( )
Examples
SUBSTRING("ABCDEF", 2, 3) = "BCD"
To extract the year out of a character field
containing a date of the form
MM/DD/YYYY, specify:
SUBSTRING(DATE, 7, 4)

UPPER( )
converts all alphabetic characters of an
expression or field value to uppercase.
when you search for data in mixed or
unknown case.
Function format:
UPPER(string)

UPPER( )
Examples
UPPER("ABC") = "ABC"
UPPER("abc 123 DEF") = "ABC 123 DEF"
UPPER("AbCd 12") = "ABCD 12"
If capitalization is a concern, you can
identify all customers named Smith by:
UPPER(NAME) = "SMITH"

DOW()
DOW( ) returns a numeric value containing a
digit from 1 to 7 which represents the day of the
week. The digit 1 represents Sunday.
To display the name of the day of the week, use
the CDOW( ) function.
Function format
DOW(date)
Example
To display the day of the week as a single digit
number:
DOW(`19991124`) = 4

DEC()
DEC( ) allows you to specify the number of
decimal places for a numeric expression or field
value. Use it when you want to adjust decimal
places in mathematical calculations, or when
you want to round a result to a specified number
of decimal places.
Function format
DEC(number, decimals)
Examples
DEC(7, 2) = 7.00
DEC(7.5647, 3) = 7.565

LIST command
to display selected output data in a columnar list
format
allows you to select information from the table to
view on screen, send to a printer, or save to a
text file. Unless otherwise specified, output is
sent only to the screen

Syntax:
LIST {<FIELDS> field_names | ALL} <TO
file_name> <LINE n> field_names
<UNFORMATTED> <IF test> <WHILE test>
<FIRST|NEXT range> <HEADER header>
<FOOTER footer> <SKIP n> <EOF> <APPEND>

LIST command
Examples:
LIST Product_number Description
Quantity Unit_cost Value HEADER
"Inventory List
LIST Product_number Description
Quantity Unit_cost Value IF Quantity < 0
OR Unit_cost < 0 HEADER "Negative
Values"

IF
IF is a scope parameter that causes a
command to be executed on records that
satisfy a specified test. IF filters out all
records that fail the test. IF is not
dependent on current record position.
Syntax
command IF test

AS
AS is used to specify a replacement name
for an existing field or ad hoc expression.
Syntax
command AS "replacement_name"

ALL
ALL is used to specify the extent to which
a command is executed either on fields or
on records. ALL specifies that a command
is to be executed on all fields,
expressions, or variables of an appropriate
type, usually numeric.
Syntax
TOTAL ALL

FILE
FILE specifies that output from a
command is to be saved in a separate file
or table.
The parameter FILE is usually omitted
from commands as it is assumed by
default.
Syntax
command TO "file_name.txt"
command TO "table_name"

OPEN
OPEN is a parameter that is used to open
a table that has been created by a
command. The newly created table is
used as the current table. This parameter
is valid only when the command creates
an output table.
Syntax
command TO "table_name" OPEN

PIC
PIC specifies how to format a date or
numeric field.

Syntax
command date_or_numeric_field PIC
"format"
Example:
LIST Acct_no Amount PIC "9,999,999.99"
TO Screen

SCREEN
SCREEN specifies that output from a
command is to be displayed for on-screen
review
Example:
CLASSIFY ON Location SUBTOTAL Value
TO SCREEN

TO
TO is used to specify the output format of
a command.
Syntax
command TO SCREEN
command TO PRINT
command TO GRAPH
command TO "table_name_or_file_name"

COMMENT
Use the COMMENT command to insert a remark
or explanation into the ACL Log file without
affecting processing or execution. COMMENT
allows you to document a session, including
such items as purposes, descriptions, and other
required explanations.
Syntax
COMMENT comment_text

WIDTH
WIDTH specifies the display width of a
specified field or expression in a report.
The default display width is the fields
defined length. The WIDTH parameter
overrides this default.
Syntax
command FIELDS field_names WIDTH
field_width

SET SAFETY OFF


Warn before overwriting files.
Syntax:
SET SAFETY ON/OFF

Writing ACLScript applications


Script - a series of ACLScript commands that
can be executed repeatedly and automatically
within your ACL project
You can create a script to analyze data using a
specific series of commands, and then reuse the
script later
By creating standard, repeatable applications,
you will realize significant savings of time and
resources in your data analysis project
Scripts can be designed to run unattended, or to
prompt for input

Ways to create a script


Write a script in the script editor (manually
or using Syntax Capture)
Create a script from the command log
Create a script from the table history
Record a script with the Script Recorder

Writing a script in the script editor


To create a script
From the menu bar, select File > New > Script. A new, blank script is
added to the Overview.
To edit a script
Double-click the script in the Overview to open it in the script editor.
To add commands to your script
Enter commands in the new script by doing one of the following:
Enter commands manually, starting each one on a new line.
Click Start Syntax Capture, and make a selection from the Data,
Analyze, or Sampling menus to open a command dialog box. Enter
command options, fields, parameters and keywords and click OK.
The commands and parameters entered are not executed until you
run the script.
Copy commands from the command log or command results and
paste into the script.
Copy commands from another script.

Creating a script from the command log


command log records every command
that you issue and the results of your
analysis
provides an excellent way to create
scripts.
each command that you perform in ACL is
recorded in the command log.
save portions of the command log as
ACLScript

Creating a script from the command log


1.
2.
3.
4.

In the Project Navigator, click the Log tab to display the


command log.
Select the sessions and individual commands that you
would like to include in the script.
Right-click and select Save Selected Items Script.
When prompted, give the script a descriptive name
and click OK.
Your new script is added to the Overview in the same
folder as the current table.

5.

Locate and double-click the script in the Overview to


edit the script in the script editor.

Creating a script with the Script


Recorder
1. Select Tools from the menu bar and choose
Set Script Recorder On.
2. Use ACL commands to process data. ACL
performs all the commands you issue and
records them in the script.
3. When you have finished processing data,
select Tools from the menu bar and choose
Set Script Recorder Off. ACL prompts you to
save and name the script.
4. Enter a new name in the text box.
5. Click OK.

DEFINE FIELD
Use the DEFINE FIELD command to create either data
fields or computed fields. You can execute this command
from the command line or from within a script, except
when you create conditional computed fields, which
require multiline syntax. Then you can only use a script.
Data fields
Data fields contain values from corresponding fields in
the source data. Enter the data field syntax on a single
line, with no carriage returns.
Syntax
DEFINE FIELD field_name data_type start_position
field_length <decimals|date_format> <AS
"alternate_column_title"> <WIDTH> <PIC "format">

ALLTRIM()
ALLTRIM( ) returns a variable length string
with leading and trailing blanks removed.
Blanks inside the character string are not
removed.
Function format
ALLTRIM(string)
Examples
ALLTRIM(" abc ") = "abc"
ALLTRIM(" a bc ") = "a bc"

Session
In the context of the command log,
sessions give you the ability to label a
series of commands for historical
purposes. When you start a session, you
can give it a descriptive name. When you
later review your log, you can easily see
the commands in the session, and the
descriptive name reminds you why you
performed the commands.

Scope parameter
A scope parameter is a statement that can
be included in an ACL command to limit
how much of a file is processed, or to limit
the execution of a command or script.
Examples are IF, WHILE, NEXT, and
FIRST.

You might also like