I am trying to convert a string variable A in Stata to a string variable B such that each observation has a fixed length. For example the string variable A is
85
01
3
and I want to convert it to another string variable B with trailing zeros in order to get length 5 for each observations
85000
01000
30000
I know that in order to put leading zeros this code works
gen B= string(real(A),"%05.0f"). How should it be modified in order to get trailing zeros?