|
actually, this is enough:
lstr=tranwrd(lstr,scan(lstr,2,'()'),upcase(scan(lstr,2,'()')));
-----Original Message-----
From: Huang, Ya
Sent: Wednesday, July 02, 2003 10:54 AM
To: 'Kristie Beth'; SAS-L@LISTSERV.UGA.EDU
Subject: RE: pulling apart character variable
This one seems to work if you have only one pair of parentheses:
data _null_;
input lstr $1-50;
lstr=tranwrd(lstr,'('||scan(lstr,2,'()')||')','('||upcase(scan(lstr,2,'()'))||')');
put lstr;
cards;
Oregon State University (Osu)
Clinical Research Project (Crp)
University of California, Santa Barbara (Ucsb)
;
Oregon State University (OSU)
Clinical Research Project (CRP)
University of California, Santa Barbara (UCSB)
NOTE: DATA statement used:
Kind regards,
Ya Huang
-----Original Message-----
From: Kristie Beth [mailto:kristie_35_89@YAHOO.COM]
Sent: Wednesday, July 02, 2003 10:34 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: pulling apart character variable
Hi SAS-L,
Maybe this question is too simple but I can't find a solution so am going to you for help, suggestions.
I want to pull apart a character string where there are parentheses and replace the existing text with upcase letters. I want to use a function like substr but do not know what word position the parentheses are at as they vary from case to case.
My strings are like so:
Oregon State University (Osu)
Clinical Research Project (Crp)
University of California, Santa Barbara (Ucsb)
Any help or suggestion are much appreciated!
thanks! Kristie
---------------------------------
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
|