Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: insheet, European format, comma

From   "Nick Cox" <>
To   <>
Subject   RE: st: insheet, European format, comma
Date   Tue, 30 Aug 2005 15:22:06 +0100

As its original parent, I am a little queasy 
at the thought of adding yet another option 
to -destring-, already a bit more complicated 
than perhaps is desirable. 

However, as Uli correctly states, this command
is now under the hand of StataCorp. 

However, -destring- was always intended to be as safe as 

Although this format is often called "European", it 
is not used in all countries of Europe, so I have
some questions for those familiar with it to inform 
those at StataCorp considering this change. 

1. If the -comma- option is intended as a special option for 
numbers in which the comma indicates the decimal 
place, shouldn't the replacement take place at 
most once? That is, any string with 2 or more 
commas cannot be a valid number and should trigger
an error message. 

2. Do other marks ever appear, e.g. stops (periods)? 


Ulrich Kohler
> Seb Buechte wrote:
> > >    Common problem for european users. The easier way to 
> avoid it: using
> > > Excel, apply function "replace" comma by point (replace all) then
> > > save as text file (tab delimited). open stata and import your .txt
> > > file will work fine.
> >
> > Why is that easier?
> Among research groups this depends on _who_ has to do it ;-)
> Probably StataCorp might add a comma-option to -destring-, hence: 
> -------------------------------------------destring.ado 
> program destring
>   syntax [varlist], [Generate(string) replace] [force] [float] /*
>                 */ [Ignore(string)] [percent] [comma]
>   if "`comma'" ~= "" {
> 	foreach var of local varlist {
> 		replace `var' = subinstr(`var',",",".",.)
> 	}
>   }
> <go on as in destring.ado>
> -----------------------------------------------------------
> As End User you might also copy destring.ado to 
> [personal]/destring2.ado and 
> make the changes there.

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index