sorry to be sooo slow in taking the opportunity and apparently repeating a part of Dale's solution - but with even more brevity and here is the code

data found ;
row +1 ;
merge have( firstobs=1 rename= digit= d1 )
have( firstobs=2 rename= digit= d2 )
have( firstobs=3 rename= digit= d3 )
have( firstobs=4 rename= digit= d4 )
have( firstobs=5 rename= digit= d5 )
;
* without BY on purpose ;
if cats( of d1-d5) ='12345' ;
keep row ;
run ;