List Data Task

About the List Data Task

The List Data task displays the contents of a table as a report. For example, you can use the List Data task to create a report that sums the expenses and revenues for each sales region.

Example: Reports of Drive Train, MSRP, and Engine Size by Car Type

In this example, you want to create reports for each car type. Each report lists the drive train, MSRP, and engine size.
To create this example:
  1. In the Tasks section, expand the Data folder and double-click List Data. The user interface for the List Data task opens.
  2. On the Data tab, select the SASHELP.CARS data set.
  3. Assign columns to these roles:
    Role
    Column Name
    List variables
    DriveTrain
    MSRP
    EngineSize
    Group analysis by
    Type
  4. To run the task, click Submit SAS code.
Here is a subset of the results:
Results of List Data Task for Sashelp.Cars Data Set

Assigning Data to Roles

Role
Description
List variables
Prints the variables in the order in which they are listed.
Group analysis by
When you assign one or more variables to this role, the table is sorted by the selected variable or variables, and a listing is generated for each distinct value, or BY group, in the variable or combination of variables.
Total of
Prints the sum of the selected variable at the bottom of the listing report.
Identifying label
When you specify one or more variables in this role, the List Data task uses the formatted values of these variables to identify the rows, rather than observation numbers (designated in the results by the column heading "Obs").

Setting Options

Option Name
Description
Basic Options
Display row numbers
Includes in the output a column that lists the row number for each observation.
You can specify a label for this column in the Column label text box. By default, the name of this column is Row number.
Use column labels as column headings
Uses the column label instead of the column name as the column heading.
Display number of rows
Reports the number of rows in the table at the end of the output, or the number of rows in each BY group at the end of each BY group’s output.
Round values before summing the variable
Rounds each numeric value to the number of decimal places in its format, or to two decimal places if no format is specified. If this option is specified, the List Data task performs the rounding before summing the variable.
Heading direction
Column headings can be printed horizontally or vertically, or you can select Default and let SAS determine the optimal arrangement for each column.
Column width
Specifies how the List Data task determines column widths:
Default
determines the column widths on a per-page basis.
Full
uses a format width (or default width if no format is specified) for all pages.
Minimum
uses the smallest possible column width on a per-page basis.
Uniform
reads the entire table to determine the appropriate column widths before generating output. When this option is not selected, different pages could have different widths for the same column.
Uniform by
formats all columns uniformly within a BY group, using each variable's formatted width as its column width. If the variable does not have a format that explicitly specifies a field width, the task uses the widest data value as the column width.
Split labels
If the variable labels contain one of the split characters (*, !, @, #, $, %, ^, &, or +), the labels will be split at the split character or characters. For example, for a variable label that reads "This is*a label" and the * character is selected as the split character, the column heading will read
This is
a label
You do not need to select both the Use variable label as column headings and Split labels options. The Split labels option implies that you want to use variable labels.
Rows to list
specifies the number of rows to list in the output. By default, all rows are listed.