Rabidwolff's Alehouse
"Your place for fun and knowledge."
HOME | Quotes | SAS | C# | BEER



Basics
FORMATS
INFORMATS
DATETIME
ATTRIB
LENGTH
FORMAT
INFORMAT
LABEL
JOINS
OPERATORS

Statements
RETAIN
FIRST.
LAST.

Procedures
PROC SORT
PROC COPY
PROC CPORT
IF ELSE
PROC REPORT

Functions
CAT
CATS
CATT
CATX

CDISC
Random Q & A

CDISC
CDISC Info

Coded Tools
XML Output
Examples

Concatenation of Strings (CAT, CATS, CATT, CATX)

Functions:

  • CAT - Concatenate keeping any spaces present
  • CATS - Concatenate removing any spaces present
  • CATT - Concatenate removing only trailing spaces
  • CATX - Concatenate removing any spaces present and placing any separating characters desired between variables with data present

Overview of CAT Functions:

  • CAT functions are simply short hand way of concatenating strings
  • Always use CAT functions over code with ‘||’ and functions TRIM and LEFT due to much faster processing
  • If numeric variables are used as a parameter then it is automatically converted by the BESTw. format, removing leading and trailing blanks and does not write notes to the log.
  • The return value’s length if not otherwise specified will be $200
  • If a return values actual length is longer than specified length or $200 then a WARNING note is posted to log and output value is either blank or truncated (depending on environment)

Example Functions:

Function Equivalent Code
CAT(OF X1-X4) TRIM(LEFT(X1))||TRIM(LEFT(X2))||TRIM(LEFT(X3))||TRIM(LEFT(X4))
CATS(OF X1-X4) X1||X2||X3||X4
CATT(OF X1-X4) TRIM(X1)||TRIM(X2)||TRIM(X3)||TRIM(X4)
CATX(SP, OF X1-X4) TRIM(LEFT(X1))||SP||TRIM(LEFT(X2))||SP||TRIM(LEFT(X3))||SP||TRIM(LEFT(X4))

Click to Show Examples:

Rabidwolff Industries | Establisted: 10/15/2011 | Version: 4 8/4/2012 | Page Last Generatated: 9/25/2021 5:21:01 PM