/******************* URBAN INSTITUTE MACRO LIBRARY *********************
: Capitalize
Macro: Autocall macro to capitalize the first letter of a text string.
Description
: Function
Use
: Peter Tatian
Author
***********************************************************************/
Capitalize(
%macro /** String var or value **/
s
);
/*************************** USAGE NOTES *****************************
:
SAMPLE CALLcapitalize( "URBAN INSTITUTE" )
%"Urban institute"
returns string value *********************************************************************/
/*************************** UPDATE NOTES ****************************
*********************************************************************/
***** ***** ***** MACRO SET UP ***** ***** *****;
%
%local ;
***** ***** ***** ERROR CHECKS ***** ***** *****;
%
***** ***** ***** MACRO BODY ***** ***** *****;
%
upcase( substr( (&s), 1, 1 ) ) || lowcase( substr( (&s), 2 ) ) )
(
***** ***** ***** CLEAN UP ***** ***** *****;
%
%mend Capitalize;
/** End Macro Definition **/
/************************ UNCOMMENT TO TEST ***************************
"Capitalize: SAS Macro";
title ** Autocall macros **;
"K:\Metro\PTatian\UISUG\Uiautos";
filename uiautos =(uiautos sasautos);
options sasautos
options mprint symbolgen mlogic;
data _null_;$ 30;
length cstr = %capitalize( "URBAN INSTITUTE" );
cstr =;
put cstr
run;
data _null_;$ 30;
length str cstr $ 1 - 12;
input str = %capitalize( str );
cstr
= cstr=;
put str
cards;
a
A
Peter Tatian
peter tatian
PETER TATIAN
pEtEr TaTiAn
;
run;/**********************************************************************/
Capitalize
Purpose: Autocall macro to capitalize the first letter of a text string.