Hi @Noomen No worries at all. Assuming you have posted a representative sample for us, the solution seems rather simple as the following. Please see if this helps.
DATA have;
texto="DURING UNLOADING, IT WAS FOUND THAT A TRUCK with UN3098 (HYDROGEN PEROXIDESPILLED)"; output;
texto="While in transit, product UN1258 spilled"; output; run;
data want;
set have;
product=prxchange('s/(.*)(UN\d{4})(.*)/$2/i', -1, texto);
run;
proc print noobs;run;
texto
product
DURING UNLOADING, IT WAS FOUND THAT A TRUCK with UN3098 (HYDROGEN PEROXIDESPILLED)
UN3098
While in transit, product UN1258 spilled
UN1258
... View more