You need to somehow add or simulate those nonexistent digits or sort the numbers in groups, each of which containing only numbers of the same length.
These 3 numbers
9912
999
123
can be transformed into
9912
0999
0123
and sorted using the regular radix sort or they can be sorted as 2 independent groups:
9912
and
999
123
The latter will give you (assuming ascending order)
123
999
and the former stays the same. Then you combine the sorted groups (from shorter numbers to longer numbers):
123
999
9912
That's all.