Given data like this
data have;
infile cards dlm='|';
input name :$32. value :$200.;
cards;
TEST1 | UNKNOWN
TEST2 | 10.411
TEST3 | 1
TEST1 | 10.1
TEST2 | 10.334
TEST3 | 11
;run;
You can check the values you want like this:
First scan for length and decimals:
data test;
set have;
prxid=prxparse('/^\d+\.?(\d*)$/');
if prxmatch(prxid,trim(value)) then do;
length=length(trim(value));
decimals=lengthn(prxposn(prxid,1,value));
end;
keep name length decimals;
run;
The PRX expression looks for a string consisting of one or more digits, a possible period, and then zero or more digits after that (and nothing else). I used the TRIM function to guard against leading blanks.
Now you just have to find the maximum values:
proc summary data=test nway;
class name;
var length decimals;
output out=want (drop=_:) max=;
run;
Edit note: I changed the second LENGTH function to LENGTHN, so that zero decimals will not be reported as one.
... View more