Well, the simple answer here normally is:
want=input(compress(have,".","kd"),best.);
However you have multiple data items in one string - which is bad data modelling and hence you have to process further.
First you will need to split the string up into elements, i.e. one data cell for one data item, e.g.:
data want;
set have;
length wrd $200;
do i=1 to countw(txn_desc,";");
wrd=scan(txn_desc,i,";");
output;
end;
run;
Now you can then apply the compress to the new variable:
data want;
set want;
new_var=input(compress(wrd,".","kd"),best.);
run;
Note, not tested - post test data in the form of a datastep in future!!!
https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...
Of course if it is really only that one data element, then you might be able to get away with:
data want;
set have;
if index(txn_desc,"P-");
want=input(substr(txn_desc,index(txn,"P-")+2,lengthn(txn_desc)-1),best.);
run;
Again untested.