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 (November 2002, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 20 Nov 2002 18:28:56 -0500
Reply-To:   Bob Burnham <robert.a.burnham@DARTMOUTH.EDU>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Bob Burnham <robert.a.burnham@DARTMOUTH.EDU>
Organization:   Dartmouth College, Hanover, NH, USA
Subject:   Re: character string parsing
Content-Type:   text/plain; charset=us-ascii

Bob Burnham <robert.a.burnham@dartmouth.edu> writes:

> +---------------------------------------------------------------- > | So for example, 746AD1 would become 746AD; 752B2 would become > | 752B; 752 would be left unchanged. Ive appended a listing of > | typical context values. > +----------------------------------------------------------------

Oops! I missed the 752 would be unchanged too! Here is the corrected code:

data test (drop=c); input context $; c = substr(context, length(context), 1); if (indexc(context, "ABCDEFGHIJKLMOPQRSTUVWXYZ")) then do; if (indexc(c, "0123456789")) then newcontext = substr(context, 1, length(context) - 1); else newcontext = context; end; else newcontext = context; datalines; 792B 736D 736E 792C1 746AD1 753C etc.

Worst of all, I can't blame this on a lack of coffee. . . :>)

Bob

-- Bob Burnham robert.a.burnham@dartmouth.edu http://www.dartmouth.edu/~bburnham


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