an excellent SUGI 29 paper (authors Paul Dorfman and someone else) refers to optimising this challenge.
In the paper at
http://www2.sas.com/proceedings/sugi29/264-29.pdf entitled "A-P-P Advanced Data Management Functions" the impressive statement which addresses this challenge is[pre]
found = ^^ indexw (peekc (addr(a), 81 ), srchfor) ; * ^^ normalizes to std boolean ;[/pre]
Implemented for your challenge, it would look something like [pre]
data result_data ;
array goname{54} $ 255 ;
set old_wide_large_enough_data ;
srchfor = "potassium" ;
POT= ^^ indexw( peekc( addr( goname1 ), %eval(54*81) ), srchfor ) ;
run;[/pre]
The array is defined before the data is SET to ensure these variables are all together for the PEEKC() function.
Much more clarification can be found in that paper, including a pointer to the alternative to peekc() for 64bit platforms.
PeterC.