| Date: | Wed, 9 May 2001 10:36:59 -0700 |
| Reply-To: | Brian Vuong <brian-vuong@USA.NET> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Brian Vuong <brian-vuong@USA.NET> |
| Organization: | Posted via Supernews, http://www.supernews.com |
| Subject: | Macro to change CAPS in addresses |
|---|
Dear SAS users:
I received the codes below from someone in this Newsgroup sometime ago. It
has been working great; however, I would like to make a change. I would
like to keep several special words in capital letters instead of changing
the first letters to capital letters and the rest to small letters. I would
like to keep these words in the addr1 field in capital letters (PO, SE, NE,
SW, NW). I greatly appreciate your helps.
%Macro Caps (S);
%Local L U LC UC I TRN;
%Let L = %Lowcase(abcdefghijklmnopqrstuvwxyz);
%Let U = %Upcase (abcdefghijklmnopqrstuvwxyz);
%Let LC = %Substr(&L,1,1);
%Let UC = %Substr(&U,1,1);
%Let TRN = Tranwrd(" "||Lowcase(&S)," &LC"," &UC");
%Do I=2 %To 26;
%Let LC = %Substr(&L,&I,1);
%Let UC = %Substr(&U,&I,1);
%Let TRN = Tranwrd(&TRN," &LC"," &UC");
%End;
Left(&Trn)
%Mend Caps;
*************************************************;
data export;
set work.export;
l_name = %Caps(l_name);
f_name = %Caps(f_name);
addr1= %Caps(addr1);
addr2= %Caps(addr2);
city = %Caps(city);
run;
Regards,
Brian Vuong
|