LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 2003, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 2 Jul 2003 11:01:55 -0700
Reply-To:     "Huang, Ya" <yhuang@AMYLIN.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Huang, Ya" <yhuang@AMYLIN.COM>
Subject:      Re: pulling apart character variable
Comments: To: Kristie Beth <kristie_35_89@YAHOO.COM>
Content-Type: text/plain; charset="iso-8859-1"

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.


Back to: Top of message | Previous page | Main SAS-L page