Previous Page | Next Page

AutoCall Macros

%LOWCASE and %QLOWCASE Autocall Macros



Change uppercase characters to lowercase.
Type: Autocall macros
Requirement: MAUTOSOURCE system option

Syntax
Details
Example
Creating a Title with Initial Letters Capitalized

Syntax

%LOWCASE (text | text expression)
%QLOWCASE (text | text expression)

Note:    Autocall macros are included in a library supplied by SAS. This library might not be installed at your site or might be a site-specific version. If you cannot access this macro or if you want to find out if it is a site-specific version, see your on-site SAS support personnel. For more information, see Storing and Reusing Macros.  [cautionend]


Details

The LOWCASE and QLOWCASE macros change uppercase alphabetic characters to their lowercase equivalents. If the argument might contain a special character or mnemonic operator, listed below, use %QLOWCASE.

LOWCASE returns a result without quotation marks, even if the argument has quotation marks. QLOWCASE produces a result with the following special characters and mnemonic operators masked so the macro processor interprets them as text instead of as elements of the macro language:

& % ' " ( ) + - * / < > = ¬ ^ ~ ; , # blank
AND OR NOT EQ NE LE LT GE GT IN


Example


Example 1: Creating a Title with Initial Letters Capitalized

%macro initcaps(title);
   %global newtitle;
   %let newtitle=;
   %let lastchar=;
   %do i=1 %to %length(&title);
      %let char=%qsubstr(&title,&i,1);
      %if (&lastchar=%str( ) or &i=1) %then %let char=%qupcase(&char);
      %else %let char=%qlowcase(&char);
      %let newtitle=&newtitle&char;
      %let lastchar=&char;
   %end;
   TITLE "&newtitle";
%mend;

%initcaps(%str(sales: COMMAND REFERENCE, VERSION 2, SECOND EDITION))

Submitting this example generates the following statement:

TITLE "Sales: Command Reference, Version 2, Second Edition";

Previous Page | Next Page | Top of Page