Understanding the SAS/IML Language


Character Literals

You can define a character matrix literal by specifying character strings between braces. If you do not place quotes around the strings, all characters are converted to uppercase. You can use either single or double quotes to preserve case and to specify strings that contain blanks or special characters. For character matrix literals, the length of the elements is determined by the longest element. Shorter strings are padded on the right with blanks. For example, the following statements define and print two $1 \times 2$ character matrices with string length 4 (the length of the longer string):

a = { abc   defg};                   /* no quotes; uppercase */
b = {'abc' 'DEFG'};                  /* quotes; case preserved */
print a, b;

Figure 3.2: Matrices Created from Character Literals

a
ABC DEFG

b
abc DEFG