If you need the leading zeroes than you must be doing a string compare since 12 and 012 are the same number. So you need to convert the number back to a string using the string function and specifying the N format for the number.
compute stringvar=string(numbervar, n9).
Hello –
After importing data from a different program into SPSS, the leading zeros on a string variable that I use as a key variable across multiple data sets are lost. I need to recapture those leading zeros.
This is an ID variable that should have nine digits. When the data are exported, only the non-zero digits remain so that, for example, ID 000022122 becomes 22122; ID 000000011 becomes 11; ID 077777777 becomes 77777777, and so on.
Is there a way to replenish the leading zeros on this variable so that the total length of each of the resulting values is 9 digits?
Thank you in advance for your help
Dawn
Free forum by Nabble | Edit this page |