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 (February 2001, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 15 Feb 2001 08:40:27 -0500
Reply-To:     Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Subject:      Re: Need help with data step

On Wed, 14 Feb 2001 22:54:57 -0500, Larry Gregg <lgregg@ACM.ORG> wrote:

I assume the %'s are wildcards. SUBSTR is one possibility, another is .... if code =: "B" .....

means: "starts with..."

The wildcards % and ? and * are not available in SAS. The only things are functions like SUBSTR, VERIFY, INDEX, ... and the : operator. The : you can use for =:, eq:, ne:, in: ... (did I forget something?)

Sometimes useful: REVERSE to reply to questions like "does it end with..."

>michelle kay wrote: >> >> Hello SAS-Lers: >> >> I currently have a SAS dataset looks like this: >> >> Acctnum Code >> 454718 1845 >> 791581 B257 >> 187272 7915 >> 712732 B1545 >> >> I would like to transform it into: >> >> Acctnum Code Init Branch >> 454718 1845 1845 NA >> 791581 B257 -999 B257 >> 187272 7915 7915 NA >> 712732 B1545 -999 B1545 >> 148155 . -999 NA >> >> this is my code, but it DOES NOT work. >> >> Data one; >> Set file; >> if CODE eq 'B%' then >> Branch=CODE; >> Init = -999; >> if CODE ne 'B%' then >> Init = CODE; >> Branch = 'NA'; >> if CODE eq . then >> Init = -999; >> Branch = NA; >> run; >> >> Thank you for all your help. >> >> Michelle Kay > >So, where does the % come from in the 'B%'? There are no >% symbols in your sample codes. Maybe you mean something like > > If substr(code,1,1) = "B" then ... ? > >Let us know. > >Larry


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