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 (May 2011, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 17 May 2011 15:18:18 -0700
Reply-To:     "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Subject:      Re: New variable from string
In-Reply-To:  <54DE14905EAB054B8DB1761F53C54BCC03756651@msgebe23.mfad.mfroot.org>
Content-Type: text/plain; charset=utf-8

> -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of > Kline, Aimee R. > Sent: Tuesday, May 17, 2011 3:07 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: New variable from string > > OK - or not attached. I'll copy/paste instead: > > CurrentVar > abcdefs_hijklmnop_&campaign=sample_example_ad_help&state=samplestate&kw > = > site%20sample%20place&ad=123456789&Network=Search&SiteTarget=&gclid=Jpd > p > oJED10658 > > NewVar1 > campaign=sample_example_ad_help > > NewVar2 > kw=site%20sample%20place > > NewVar3 > ad=123456789 > >

Aimee,

Here is a variation on Data _Null_'s solution to get what you want

Data Need ; text = 'abcdefs_hijklmnop_&campaign=sample_example_ad_help&state=samplestate&kw=site%20sample%20place&ad=123456789&Network=Search&SiteTarget=&gclid=JpdpoJED10658'; NewVar1 = PrxChange( 's/.+&(Campaign=.+)&.+/$1/io' , 1 , Text ) ; NewVar2 = PrxChange( 's/.+&(kw=.+)&.+/$1/io' , 1 , Text ) ; NewVar3 = PrxChange( 's/.+&(ad=.+)&.+/$1/io' , 1 , Text ) ; Run ;

Hope this is helpful,

Dan

Daniel J. Nordlund Washington State Department of Social and Health Services Planning, Performance, and Accountability Research and Data Analysis Division Olympia, WA 98504-5204


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