L  (list) and LCSV (list CSV)

<< Click to Display Table of Contents >>

Navigation:  Reference > Commands >

L  (list) and LCSV (list CSV)

The form of the L (list) command is one of the following:

L 'text' . table,

L x . x . ... ,

LCSV [(extra)] x . x . ... ,

where x is either a variable or text. Any table or variable must previously have been defined in the code.

The L (list) command cannot be used with MINSHOW .

The L (list) command is used to provide a report on the state of the data or tables during execution. When a L (list) command is encountered, text and/or the value(s) of table or variable are written to the output file.

L (list) output will be placed in the Report file and lines which exceed RPTSPL characters will be broken into two or more lines.

LCSV (list comma separated value) output will be placed in the .CSV file and lines will not be broken.

Optionally, LCSV can be followed by extra facilities separated by a comma:

(H) causes a header row to output to the CSV file the first time an LCSV command is executed in a run.

(Q) causes a (usually second) header row to be output with the question texts (VT, or HT if no VT).

(T) causes a tab-delimited file to be output instead of a comma-delimited file (not recommended).

(H,Q) two header lines: names then texts.

For svar and mvar variables:

The number(s) of the true bits are normally listed.

The variable name can be preceded by an ampersand (&). This causes the item texts to be listed instead of the item numbers.

The variable name can also be preceded by an asterisk (*). This cause a separate column to be output for every item in the variable.  Each column is headed with the variable name followed by underscore followed by the item number.  So the third item column for variable  $sa will be sa_3.

When a table is listed, the values are enclosed in parentheses and separated by commas. When used in conjunction with run control parameter STRIPRPT, the Report file output can be used in a CL script as a table of constants.

When listing a table, CL will honour formats PTR (Print Total Row) and PTC (Print Total Column).

An alternative form of the L (list) command is EL. In addition to the reporting function, it increments the error variable $XIERR, see section Reserved variable names

A summary of the number of times each L or LCSV command was executed (a summary of errors encountered in the data) appears in the Report file. The summary also shows as a percentage the frequency of each error's occurrence.

If F=NVNL (No Variable Names in List), then the name of the variable is not printed in the listing: just the value is produced.

If F=NVWL (No Variable Width in List), then the output field width for variable values is fixed, so that the output Report file can be sorted.

Examples of L (list) and LCSV commands:

l 'Factors'.#fac,

l $15,

l 'Age'.&$age,

if $46-49/b, l 'Cols 46-49 blank',

l $27.$mvar.$28.'Rubbish',

lcsv $iobs.$q1,

lcsv(h) $iobs.$weight,

lcsv(h) $iobs.&$s1.&$s2,     ! outputs item texts in place of numbers

lcsv(h) $iobs.*$s1.*$s2,     ! outputs each item in its own column

lcsv(h,q) $iobs.&*$s1.&*$s2, ! outputs each item as text in its own column