Chapter Contents

Previous

Next
POSITION Variable

POSITION Variable



Controls placement and alignment of a text string specified by the LABEL function.

Type: character
Length: 1
Default: 5


Syntax
Details
Stacking text strings
Positioning numeric labels
Changing attributes in the middle of a text string

Syntax

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

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:

Horizontal Position > Vertical Position V 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

[IMAGE]


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.  [cautionend]

Effect of POSITION Values on Text Strings

[IMAGE]


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

[IMAGE]


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.