QUOTE Function


Adds double quotation marks to a character value

Category: Character

Syntax

QUOTE ( argument )

Arguments

argument

  • is a character value.

Details

If the QUOTE function returns a value to a variable that has not yet been assigned a length, then by default the variable is assigned a length of 200.

The QUOTE function adds double quotation marks, the default character, to a character value. If double quotation marks are found within the argument, they are doubled in the output.

The length of the receiving variable must be long enough to contain the argument (including trailing blanks), leading and trailing quotation marks, and any embedded quotation marks that are doubled. For example, if the argument is ABC followed by three trailing blanks, then the receiving variable must have a length of at least eight to hold 'ABC###'. (The character # represents a blank space.) If the receiving field is not long enough, the QUOTE function returns a blank string, and writes an invalid argument note to the log.

Examples

SAS Statements

Results

  x='A"B';   y=quote(x);   put y;  
  "A""B"  
  x='A''B';   y=quote(x);   put y;  
  "A'B"  
  x='Paul''s';   y=quote(x);   put y;  
  "Paul's"  
  x='Paul''s Catering Service      ';   y=quote(trim(x));   put y;  
  "Paul's Catering Service"  



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