Previous Topic: Complex Variable Substitution

Next Topic: Lowercase Data

Align Substitution Data

The substitution process does not, by default, preserve any difference in the length between a variable name and the data being substituted in place of the variable. This can make tabular output of rows of numbers difficult or impossible to align when not using full-screen facilities.

The &CONTROL statement provides the ALIGNL and ALIGNR options to specify special alignment requirements. ALIGNL requests left alignment and ALIGNR right alignment. Both of these options can additionally identify a fill character (by default a blank) that is to be used, for example, ALIGNR$.

When using these alignment options, the length of the name of the variable itself is used to determine both the point of alignment and the number of fill characters required. Therefore variables with names of the same length must be used to ensure the correct alignment is achieved.

Example: Aligning Substitution Data

In this example, the three variables &COUNT01, &COUNT02 and &COUNT03 are used to display a table of numbers. They are to be right-aligned and padded with leading dashes (-).

&CONTROL ALIGNR-
&COUNT01 = 1
&COUNT02 = 1098
&COUNT03 = 66
&WRITE DATA=COUNT 1 = &COUNT01
&WRITE DATA=COUNT 2 = &COUNT02
&WRITE DATA=COUNT 3 = &COUNT03

The result is:

COUNT 1 = -------1
COUNT 2 = ----1098
COUNT 3 = ------66

Note: These techniques are designed to be used by NCL procedures running in the OCS environment which do not utilize full-screen panels.