The collected digits buffer in the set command does not include dial-ahead-digits, nor does the collected digits buffer overwrite any current dial-ahead digits unless there is a subsequent collect step.
Collected Digit buffer
Dial-ahead digits
Command: set digits = digits ADD 1111
1234
5678
Sets the collected digits buffer to 2345 and the dial-ahead digits remain as 5678
Collected Digits buffer
Dial-ahead digits
Command: collect 4 digits
2345
5678
Sets the collected digits buffer to 5678 and the dial-ahead digits do not contain any digits