Rectangular File

The following figure shows contents of data file RECTANG.DAT, which contains 1988 sales data for salespeople working in different territories. Year, region, and unit sales are recorded for each salesperson. Like most data files, the sales data file has a rectangular format, since information on a record applies only to one case.

Figure 1. File RECTANG.DAT
1988 CHICAGO     JONES      900
1988 CHICAGO     GREGORY    400
1988 BATON ROUGE RODRIGUEZ  300
1988 BATON ROUGE SMITH      333
1988 BATON ROUGE GRAU       100

Since the sales data are rectangular, you can use the DATA LIST command to define these data:

DATA LIST FILE='RECTANG.DAT' 
 / YEAR     1-4
   REGION   6-16(A)  
   SALESPER 18-26(A)
   SALES    29-31.
  • DATA LIST defines the variable YEAR in columns 1 through 4 and string variable REGION in columns 6 through 16 in file RECTANG.DAT. The program also reads variables SALESPER and SALES on each record.
  • The LIST output below shows the contents of each variable.
Figure 2. LIST output for RECTANG.DAT
YEAR REGION      SALESPER  SALES

1988 CHICAGO     JONES      900
1988 CHICAGO     GREGORY    400
1988 BATON ROUGE RODRIGUEZ  300
1988 BATON ROUGE SMITH      333
1988 BATON ROUGE GRAU       100