Another possibility is to use PRX functions, which enables you to check for numbers in the right places: data want;
set m;
length pr_id $5 pr_name $40 pr_qty $5;
prxid=prxparse('/^(\d+) (.+) (\d+)\s*$/');
if not prxmatch(prxid,info) then
error 'No match';
else do;
pr_id=prxposn(prxid,1,info);
pr_name=prxposn(prxid,2,info);
pr_qty=prxposn(prxid,3,info);
end;
keep info pr_:;
run; The PRX string searches for beginning of string "^", some digits "\d+" which are placed in the first capture buffer (the "()" around), a blank, a string which can be anything (".+", in the second capture buffer), a blank, some digits in the third capture buffer, and finally some whithespace "\s*" and end of string "$". You then use PRXPOSN to get at the capture buffers.
... View more