|
The original import file is a csv file and it truncates leading zeros. Is
there a syntax script that will automatically add the zeros back into the zip fields. Sometimes I need to add 1 zero and sometimes 2 zeros. Thanks. ===================== 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 |
|
Are you sure that the csv format has truncated leading zeros? Have you
opened the file in Excel? If so, try to open the same file with textpad or any other text editor and you should find the leading zero in your zip codes as Excel automatically eliminates leading zeros, unless of course they were not present when the csv file was created... Cheers, Luca Mr. Luca MEYER Market research, data analysis & more www.lucameyer.com - Tel: +39.339.495.00.21 -----Messaggio originale----- Da: SPSSX(r) Discussion [mailto:[hidden email]] Per conto di <Joanne Tse> Inviato: venerdì 14 dicembre 2007 22.16 A: [hidden email] Oggetto: Building Syntax Script to Add Truncated Zeros to Zip Field The original import file is a csv file and it truncates leading zeros. Is there a syntax script that will automatically add the zeros back into the zip fields. Sometimes I need to add 1 zero and sometimes 2 zeros. Thanks. ===================== 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 No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.503 / Virus Database: 269.17.1/1183 - Release Date: 13/12/2007 9.15 No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.503 / Virus Database: 269.17.1/1183 - Release Date: 13/12/2007 9.15 ===================== 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
Mr. Luca Meyer
www.lucameyer.com |
|
In reply to this post by <Joanne Tse>
At 04:16 PM 12/14/2007, <Joanne Tse> wrote:
>The original import file is a csv file and it truncates leading >zeros. Is there a syntax script that will automatically add the >zeros back into the zip fields. Sometimes I need to add 1 zero and >sometimes 2 zeros. OK. SPSS numbers neither *have* nor *don't have* leading zeroes. They're stored in a binary floating-point form. You have two choices. a. Set a format so the number *displays* with leading zeroes: FORMATS Zip_Code (N5). b. Make your ZIP codes *character* variables, with the display you want: STRING Zip_Char (A5). COMPUTE Zip_Char=NUMBER(Zip_Code,N5). ===================== 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 |
|
In reply to this post by lucameyer
Hi,
You can add an apostrophe to your zip code variable before you export it to xls. This assumes that your existing zip code variable already is a string variable, and has the right width + one extra (for the additional apostrophe). compute zipnew = concat("'",zipold). Cheers!! Albert-Jan --- Luca Meyer <[hidden email]> wrote: > Are you sure that the csv format has truncated > leading zeros? Have you > opened the file in Excel? If so, try to open the > same file with textpad or > any other text editor and you should find the > leading zero in your zip codes > as Excel automatically eliminates leading zeros, > unless of course they were > not present when the csv file was created... > > Cheers, > Luca > > Mr. Luca MEYER > Market research, data analysis & more > www.lucameyer.com - Tel: +39.339.495.00.21 > > > -----Messaggio originale----- > Da: SPSSX(r) Discussion > [mailto:[hidden email]] Per conto di > <Joanne Tse> > Inviato: venerdì 14 dicembre 2007 22.16 > A: [hidden email] > Oggetto: Building Syntax Script to Add Truncated > Zeros to Zip Field > > The original import file is a csv file and it > truncates leading zeros. Is > there a syntax script that will automatically add > the zeros back into the > zip fields. Sometimes I need to add 1 zero and > sometimes 2 zeros. > > Thanks. > > ===================== > 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 > > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.503 / Virus Database: 269.17.1/1183 - > Release Date: 13/12/2007 > 9.15 > > > No virus found in this outgoing message. > Checked by AVG Free Edition. > Version: 7.5.503 / Virus Database: 269.17.1/1183 - > Release Date: 13/12/2007 > 9.15 > > ===================== > 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 > Cheers! Albert-Jan ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Did you know that 87.166253% of all statistics claim a precision of results that is not justified by the method employed? [HELMUT RICHTER] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ____________________________________________________________________________________ Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping ===================== 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 |
|
Thanks everyone for the responses!
-----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Albert-jan Roskam Sent: Monday, December 17, 2007 1:30 AM To: [hidden email] Subject: Re: R: Building Syntax Script to Add Truncated Zeros to Zip Field Hi, You can add an apostrophe to your zip code variable before you export it to xls. This assumes that your existing zip code variable already is a string variable, and has the right width + one extra (for the additional apostrophe). compute zipnew = concat("'",zipold). Cheers!! Albert-Jan --- Luca Meyer <[hidden email]> wrote: > Are you sure that the csv format has truncated > leading zeros? Have you > opened the file in Excel? If so, try to open the > same file with textpad or > any other text editor and you should find the > leading zero in your zip codes > as Excel automatically eliminates leading zeros, > unless of course they were > not present when the csv file was created... > > Cheers, > Luca > > Mr. Luca MEYER > Market research, data analysis & more > www.lucameyer.com - Tel: +39.339.495.00.21 > > > -----Messaggio originale----- > Da: SPSSX(r) Discussion > [mailto:[hidden email]] Per conto di > <Joanne Tse> > Inviato: venerdì 14 dicembre 2007 22.16 > A: [hidden email] > Oggetto: Building Syntax Script to Add Truncated > Zeros to Zip Field > > The original import file is a csv file and it > truncates leading zeros. Is > there a syntax script that will automatically add > the zeros back into the > zip fields. Sometimes I need to add 1 zero and > sometimes 2 zeros. > > Thanks. > > ===================== > 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 > > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.503 / Virus Database: 269.17.1/1183 - > Release Date: 13/12/2007 > 9.15 > > > No virus found in this outgoing message. > Checked by AVG Free Edition. > Version: 7.5.503 / Virus Database: 269.17.1/1183 - > Release Date: 13/12/2007 > 9.15 > > ===================== > 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 > Cheers! Albert-Jan ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Did you know that 87.166253% of all statistics claim a precision of results that is not justified by the method employed? [HELMUT RICHTER] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ____________________________________________________________________________________ Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping ===================== 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 |
