/******************* URBAN INSTITUTE MACRO LIBRARY *********************
: MCapitalize
Macro: Autocall macro returns macro text value with first letter
Description
capitalized and the rest lowercase.
: Function
Use
: Peter Tatian
Author
***********************************************************************/
MCapitalize( s );
%macro
/*************************** USAGE NOTES *****************************
:
SAMPLE CALLMCapitalize( aBcDE )
%
Returns Abcde*********************************************************************/
/*************************** UPDATE NOTES ****************************
01/02/03 Peter A. Tatian
*********************************************************************/
***** ***** ***** MACRO SET UP ***** ***** *****;
%
***** ***** ***** ERROR CHECKS ***** ***** *****;
%
***** ***** ***** MACRO BODY ***** ***** *****;
%
%if %length( &s ) > 1 %then %do;
%upcase( %substr( &s, 1, 1 ) )%lowcase( %substr( &s, 2 ) )
%end;%else %do;
upcase( &s )
%
%end;
***** ***** ***** CLEAN UP ***** ***** *****;
%
%mend MCapitalize;
/************************ UNCOMMENT TO TEST ***************************
"MCapitalize: SAS Macro";
title ** Autocall macros **;
"K:\Metro\PTatian\UISUG\Uiautos";
filename uiautos =(uiautos sasautos);
options sasautos**options mprint symbolgen mlogic;
= ;
%let str %let cstr = %MCapitalize( &str );
=&str cstr=&cstr;
%put str= a;
%let str %let cstr = %MCapitalize( &str );
=&str cstr=&cstr;
%put str= Abcd Efgh;
%let str %let cstr = %MCapitalize( &str );
=&str cstr=&cstr;
%put str= abcd efgh;
%let str %let cstr = %MCapitalize( &str );
=&str cstr=&cstr;
%put str= ABCD EFGH;
%let str %let cstr = %MCapitalize( &str );
=&str cstr=&cstr;
%put str= aBcD eFgH;
%let str %let cstr = %MCapitalize( &str );
=&str cstr=&cstr;
%put str/**********************************************************************/
Capitalize Macro Text
Purpose: Autocall macro returns macro text value with first letter capitalized and the rest lowercase.