![]() Chapter Contents |
![]() Previous |
![]() Next |
| %LOWCASE and %QLOWCASE |
| Type: | Autocall macros |
| Requires: | 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 Institute. This library may not be installed at your site or may 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 SAS Software Consultant.
For more information, see Chapter 9 in SAS Macro Language: Reference. ![[cautionend]](../common/images/cautend.gif)
| 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
| Example |
%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";
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.