Date: Wed, 25 Sep 2002 06:00:00 GMT
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gregg Snell <gsnell@DATASAVANTCONSULTING.COM>
Subject: Re: brute force cleanup
Have you even tried my code yet? From what you are saying, it should work for
nearly all circumstances. And unless you expect more than one "mg" to appear
in the field, it will work without doing any of your initial substringing.
Why don't you try it out on the first 10K records and see how close you get?
>I don't think either of these will work. The value I am trying to keep is possibly
>up to 3 digits but maybe more not just one digit. I'm trying to keep the number
>of the string 'mg' but nothing else.
>Gregg Snell wrote:
>> if "mg" is your keyword, then this might work (but I would test it with all
>> the other combinations you might have)
>> data _null_;
>> if index(_infile_,'mg') > 1 then
>> put amount=;
>> 10 mg
>> 1/2 tab (5mg tabs)
>> Gregg P. Snell
>> Data Savant Consulting
>> >Have you looked at the regular expression functions in version 8?
>> >They'll be better in version 9, but I think you can still do what you
>> >want in version 8. Some functionality is even available in 6.12.
>> >It's not clear to me what you want returned in "1/2 tab (5mg tabs)".
>> >Do you want "1/2" or "5"? Is "tab" the keyword you're looking for to
>> >locate "5"? Are you sure you'll never see "5mg tab (1/2 tab)"?
>> >Manager, Technical Development
>> >METRICS Department, First Health
>> >West Sacramento, California USA
>> >>>> "William Kossack" <kossackw@NJC.ORG> 09/25/2002 8:34 AM >>>
>> >I'm continuing with my data cleanup in a brute force method (see
>> >I have a field containing numeric amounts that I want but due to the
>> >wonders of data entry
>> >I have values such as
>> >10 mg
>> >1/2 tab (5mg tabs)
>> >I can get at the 10 in the '10 mg'
>> >but when I try to use indexc to find the chop point in
>> >'tab (5mg tabs)' to get at the 5 it gives me confusing results
>> >I had figured that I could use indexc in a statement like
>> >searchstr = ' 0123456789.';
>> >location2 = indexc(amount, not searchstr);
>> >How can I best find my chop point to remove the trash in front of the
>> >numeric value I'm wanting?