POSITION Variable

Controls placement and alignment of a text string specified by the LABEL function.
Type: character
Length: 1
Default: 5

Syntax

POSITION='text-position' | '0';

Variable Values

text-position
specifies the placement of the text string in relation to the position that is defined by the X and Y variables. Text-position can be one of the characters 1 through 9, A through F, <, +, or >. These characters represent the positions that are described in the following table:
Position
Right Aligned
Centered
Left Aligned
One cell above
1
2
3
Centered
4 | <
5 | +
6 | >
One cell below
7
8
9
Half cell above
A
B
C
Half cell below
D
E
F
These positions are illustrated in Effect of POSITION Values on Text Strings.
'0'
specifies a pause in the string in order to change an attribute, such as the color of the text.

Details

Stacking Text Strings

To stack text strings, specify a different position value of each string. Combining POSITION Values to Stack Text shows two ways to stack text.
Combining POSITION Values to Stack Text
Combining POSITION Values to Stack Text

Positioning Numeric Labels

The <, +, and > positions perform the same function as 4, 5, and 6, respectively, but are recommended only for labels that are numbers. The <, +, and > positions are especially useful when you are labeling a horizontal bar chart. You can use <, +, or > if the numbers in your font are significantly smaller than the text and you are having trouble centering labels. If the numbers in your font are the same height or close to the same height as the text, you can use positions 4, 5, and 6 to center the labels.
Note: You cannot stack <, +, and > positions as you can 4, 5, and 6 positions.
Effect of POSITION Values on Text Strings
Effect of POSITION Values on Text Strings

Changing Attributes in the Middle of a Text String

0 is a special value to use when you want to pause and then continue a text string. With this value, you can change colors, fonts, and so on, in the middle of a line, while retaining the exact position of the text at the pause. When POSITION='0', the combined text string is left-justified beginning at the point that is defined by the X and Y variables. However, you must define missing values for X for the continuation string. The following Annotate data set changes the font in the middle of the string. The result is shown in Using POSITION='0' to Change the Attributes of a Text String.
data anno;
   length style $ 8 text $ 12;
   xsys="3"; ysys="3"; hsys="3"; x=5; y=50;
      style="swissb"; size=10; text="This is the";
      position="0"; output;
   x=.; style="swissbi"; text=" ITALIC font";
       output;
run;
Using POSITION='0' to Change the Attributes of a Text String
Using POSITION='0' to Change the Attributes of a Text String