|
Fraser Neiman <fn9r@Virginia.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.
+----------------------------------------------------------------
Fraser,
Try something like this:
data test (drop=c);
input context $;
c = substr(context, length(context), 1);
if (indexc(c, "0123456789") > 0) then
newcontext = substr(context, 1, length(context) - 1);
else newcontext = context;
datalines;
792B
736D
736E
792C1
746AD1
753C
etc.
It should produce output something like this:
context newcontext
792B 792B
736D 736D
736E 736E
792C1 792C
746AD1 746AD
753C 753C
785AA2 785AA
779AC2 779AC
764AA3 764AA
753AA3 753AA
737TPS 737TPS
You can combine several of the lines into one statement and
avoid using the temporary 'c' variable -- but I think it might
clearer this way.
Hope this helps,
Bob
--
Bob Burnham
robert.a.burnham@dartmouth.edu
http://www.dartmouth.edu/~bburnham
|