|
I have an ID variable that should be 6 charachters long some ranging from
000001 to 999999. Some of the records lost their leading zeros so instead of having 000015 the computer stored 15, this is not the case for all of the IDs with leading zeros some are stored properly as 000023 and the very next one wil be 24 without the leading zeros. I want to create syntax to add the leading zeros, but I can't figure out how to conditionally prepend the zeros to just the cases that don't already have them. Any help would be appreciated. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
formats ID (n6).
________________________________ From: SPSSX(r) Discussion on behalf of Don Asay Sent: Mon 1/7/2008 5:54 PM To: [hidden email] Subject: Adding Leading Zeros To An ID I have an ID variable that should be 6 charachters long some ranging from 000001 to 999999. Some of the records lost their leading zeros so instead of having 000015 the computer stored 15, this is not the case for all of the IDs with leading zeros some are stored properly as 000023 and the very next one wil be 24 without the leading zeros. I want to create syntax to add the leading zeros, but I can't figure out how to conditionally prepend the zeros to just the cases that don't already have them. Any help would be appreciated. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ====================To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
The reply assumes that the ID variable is a number. Is it a string or a
number? If it is a string, is it displayed left-justified or right-justified within the data editor? That will determine how to modify the string value. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Oliver, Richard Sent: Monday, January 07, 2008 6:14 PM To: [hidden email] Subject: Re: Adding Leading Zeros To An ID formats ID (n6). ________________________________ From: SPSSX(r) Discussion on behalf of Don Asay Sent: Mon 1/7/2008 5:54 PM To: [hidden email] Subject: Adding Leading Zeros To An ID I have an ID variable that should be 6 charachters long some ranging from 000001 to 999999. Some of the records lost their leading zeros so instead of having 000015 the computer stored 15, this is not the case for all of the IDs with leading zeros some are stored properly as 000023 and the very next one wil be 24 without the leading zeros. I want to create syntax to add the leading zeros, but I can't figure out how to conditionally prepend the zeros to just the cases that don't already have them. Any help would be appreciated. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ======= To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
| Free forum by Nabble | Edit this page |
