Note updated as you don't need the select (your format matches the name.
Sorry, really can't read that code, try coding all in one case, use indents correctly etc. it makes reading the code so much easier. Also simplfy out your code, there is no need to do X amount of datasteps, just a logical thought on what goes in is enough:
data fmts (keep=label start);
set db.key_aktivpassiv (rename=(aktivpassiv=label aktivpassivid=start))
db.key_cashflowtyp (rename=(cashflowtyp=label cashflowtypid=start))
... indsname=tmp; fmtname=strip(tranwrd(scan(tmp,2,"."),"key_",""));
run;
This code will effectively replace the series of datasteps you currently have. I would also question why you need so many formats, effectively duplicating the data which already exists?
... View more