CALL CATT Routine


Concatenates character strings and removes trailing blanks

Category: Character

Syntax

CALL CATT ( result <, string-1 , ... string-n >);

Arguments

result

  • specifies a SAS variable.

string

  • specifies a SAS character string.

Details

The CALL CATT routine returns the result in the first argument, result . The routine appends the values of the arguments that follow to result . If the length of result is not large enough to contain the entire result, SAS

  • writes a warning message to the log stating that the result was truncated

  • writes a note to the log that shows the location of the function call and lists the argument that caused the truncation , except in SQL or in a WHERE clause

  • sets _ERROR_ to 1 in the DATA step, except in a WHERE clause.

The CALL CATT routine removes leading and trailing blanks from numeric arguments after it formats the numeric value with the BEST. format.

Comparisons

The results of the CALL CATS, CALL CATT, and CALL CATX routines are usually equivalent to statements that use the concatenation operator () and the TRIM and LEFT functions. However, using the CALL CATS, CALL CATT, and CALL CATX routines is faster than using TRIM and LEFT.

The following table shows statements that are equivalent to CALL CATS, CALL CATT, and CALL CATX. The variables X1 through X4 specify character variables , and SP specifies a separator, such as a blank or comma.

CALL Routine

Equivalent Statement

CALL CATS(res, OF X1-X4);

res=TRIM(LEFT(X1))TRIM(LEFT(X2))TRIM(LEFT(X3))a TRIM(LEFT(X4));

CALL CATT(OF X1-X4);

X1=TRIM(X1)TRIM(X2)TRIM(X3)TRIM(X4);

CALL CATX(SP, OF X1-X4); [*]

X1=TRIM(LEFT(X1))SPTRIM(LEFT(X2))SP TRIM(LEFT(X3))SPTRIM(LEFT(X4));

[*] If any of the arguments is blank, the results that are produced by CALLCATX differ slightly from the results that are produced by the concatenated code. In this case, CALL CATX omits the corresponding separator. For example, CALL CATX("+","X"," ", "Z"," "); produces X+Z .

Examples

The following example shows how the CALL CATT routine concatenates strings.

 data _null_;     length answer $ 36;     x='Athens is t   ';     y='he Olym     ';     z='pic site for 2004. ';     call catt(answer,x,y,z);     put answer;  run; 

The following line is written to the SAS log:

 ----+----1----+----2----+----3----+----4  Athens is the Olympic site for 2004. 

See Also

Functions and CALL Routines:

  • 'CAT Function' on page 411

  • 'CATS Function' on page 412

  • 'CATT Function' on page 414

  • 'CATX Function' on page 416

  • 'CALL CATS Routine' on page 337

  • 'CALL CATX Routine' on page 340




SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net