Hi,
I would like to write a fixed width ascii file where the decimal separator is a comma. The syntax below works: -why-oh-why do I need to specify DOT if I want a COMMA as a decimal separator? -Can the same goal be accomplished using SET DECIMAL=DOT/COMMA? SET LOCALE requires that no files are open. file handle a_handle /name = "%temp%\american.dat". file handle e_handle /name = "%temp%\european.dat". * test data. set locale = "en_US.windows-1252". data list free /american_notation (f12.3). begin data 10.300 13.0001 0.0001 end data. write outfile = a_handle table /all. execute. * write as a file with the European notation (comma als decimal separator). get data /type = txt /file = a_handle /fixcase = 1 /arrangement = fixed /firstcase = 1 /importcase = all /variables= /1 american_notation 0-12 f13.3. cache. execute. write outfile = e_handle table /all (dot13.3). /* what's the logic of this?! DOT if you want COMMA?! /*. execute. * check if it can be read again. dataset close all. new file. set locale = "nl_NL.windows-1252". get data /type = txt /file = e_handle /fixcase = 1 /arrangement = fixed /firstcase = 1 /importcase = all /variables= /1 european_notation 0-12 f13.3. cache. execute. Thanks in advance! Regards, Albert-Jan ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ===================== 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 |
Hi,
I would like to write a fixed width ascii file where the decimal separator is a comma. The syntax below works: -why-oh-why do I need to specify DOT if I want a COMMA as a decimal separator? >>>The DOT and COMMA formats are named for the digit-grouping character, not the decimal character. If the field width is too narrow, however, to accommodate grouping separators, they are automatically suppressed. -Can the same goal be accomplished using SET DECIMAL=DOT/COMMA? SET LOCALE requires that no files are open. >>>Actually, you can get away with changing the locale with data loaded as long as the character encoding is the same. SET DECIMAL should be sufficient here, however. Thanks in advance! Regards, Albert-Jan ===================== 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 |
--------------------------------------------
On Wed, 4/22/15, Jon K Peck <[hidden email]> wrote: Subject: Re: [SPSSX-L] writing fixed width with comma as decimal separator To: [hidden email] Date: Wednesday, April 22, 2015, 4:48 PM Hi, I would like to write a fixed width ascii file where the decimal separator is a comma. The syntax below works: -why-oh-why do I need to specify DOT if I want a COMMA as a decimal separator? >>>The DOT and COMMA formats are named for the digit-grouping character, not the decimal character. If the field width is too narrow, however, to accommodate grouping separators, they are automatically suppressed. ---> OK, I should have read that in the manual. Thank you. -Can the same goal be accomplished using SET DECIMAL=DOT/COMMA? SET LOCALE requires that no files are open. >>>Actually, you can get away with changing the locale with data loaded as long as the character encoding is the same. SET DECIMAL should be sufficient here, however. ---> Nice to know. For my understanding: does SET LOCALE = "en_US.windows-1252" DECIMAL = COMMA. mean "English locale, but with the comma as a decimal separator (and you have to take care of a possibly confusing digitgrouping symbol yourself)? Manual: DECIMAL can be used to override the default decimal indicator for reading and writing text data. The default decimal indicator is the OS locale decimal indicator or the decimal indicator for the locale specified on the LOCALE subcommand. Thanks in advance! Regards, Albert-Jan ===================== 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 |
set locale=english decimal=comma.
show locale decimal. data list list / x. begin data. 1,2 3,4 5 end data. list. DESCRIPTIVES x. but DECIMAL does not control the pivot table format. Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] phone: 720-342-5621 From: Albert-Jan Roskam <[hidden email]> To: [hidden email] Date: 04/22/2015 09:27 AM Subject: Re: [SPSSX-L] writing fixed width with comma as decimal separator Sent by: "SPSSX(r) Discussion" <[hidden email]> -------------------------------------------- On Wed, 4/22/15, Jon K Peck <[hidden email]> wrote: Subject: Re: [SPSSX-L] writing fixed width with comma as decimal separator To: [hidden email] Date: Wednesday, April 22, 2015, 4:48 PM Hi, I would like to write a fixed width ascii file where the decimal separator is a comma. The syntax below works: -why-oh-why do I need to specify DOT if I want a COMMA as a decimal separator? >>>The DOT and COMMA formats are named for the digit-grouping character, not the decimal character. If the field width is too narrow, however, to accommodate grouping separators, they are automatically suppressed. ---> OK, I should have read that in the manual. Thank you. -Can the same goal be accomplished using SET DECIMAL=DOT/COMMA? SET LOCALE requires that no files are open. >>>Actually, you can get away with changing the locale with data loaded as long as the character encoding is the same. SET DECIMAL should be sufficient here, however. ---> Nice to know. For my understanding: does SET LOCALE = "en_US.windows-1252" DECIMAL = COMMA. mean "English locale, but with the comma as a decimal separator (and you have to take care of a possibly confusing digitgrouping symbol yourself)? Manual: DECIMAL can be used to override the default decimal indicator for reading and writing text data. The default decimal indicator is the OS locale decimal indicator or the decimal indicator for the locale specified on the LOCALE subcommand. Thanks in advance! Regards, Albert-Jan ===================== 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 |
Note that order matters here, because changing
the locale always overrides any previous change in the decimal indicator.
set decimal comma locale english. show decimal. /*decimal has been reset to English default (dot). set locale english decimal comma. show decimal. /*now the decimal is comma. Rick Oliver Senior Information Developer IBM Business Analytics (SPSS) E-mail: [hidden email] From: Jon K Peck/Chicago/IBM@IBMUS To: [hidden email] Date: 04/22/2015 10:39 AM Subject: Re: writing fixed width with comma as decimal separator Sent by: "SPSSX(r) Discussion" <[hidden email]> set locale=english decimal=comma. show locale decimal. data list list / x. begin data. 1,2 3,4 5 end data. list. DESCRIPTIVES x. but DECIMAL does not control the pivot table format. Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] phone: 720-342-5621 From: Albert-Jan Roskam <[hidden email]> To: [hidden email] Date: 04/22/2015 09:27 AM Subject: Re: [SPSSX-L] writing fixed width with comma as decimal separator Sent by: "SPSSX(r) Discussion" <[hidden email]> -------------------------------------------- On Wed, 4/22/15, Jon K Peck <[hidden email]> wrote: Subject: Re: [SPSSX-L] writing fixed width with comma as decimal separator To: [hidden email] Date: Wednesday, April 22, 2015, 4:48 PM Hi, I would like to write a fixed width ascii file where the decimal separator is a comma. The syntax below works: -why-oh-why do I need to specify DOT if I want a COMMA as a decimal separator? >>>The DOT and COMMA formats are named for the digit-grouping character, not the decimal character. If the field width is too narrow, however, to accommodate grouping separators, they are automatically suppressed. ---> OK, I should have read that in the manual. Thank you. -Can the same goal be accomplished using SET DECIMAL=DOT/COMMA? SET LOCALE requires that no files are open. >>>Actually, you can get away with changing the locale with data loaded as long as the character encoding is the same. SET DECIMAL should be sufficient here, however. ---> Nice to know. For my understanding: does SET LOCALE = "en_US.windows-1252" DECIMAL = COMMA. mean "English locale, but with the comma as a decimal separator (and you have to take care of a possibly confusing digitgrouping symbol yourself)? Manual: DECIMAL can be used to override the default decimal indicator for reading and writing text data. The default decimal indicator is the OS locale decimal indicator or the decimal indicator for the locale specified on the LOCALE subcommand. Thanks in advance! Regards, Albert-Jan ===================== 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 LISTSERV@... (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 |