Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: re: destring var, replace dpcomma


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: re: destring var, replace dpcomma
Date   Mon, 21 Apr 2008 19:25:03 +0100

There are two distinct issues here. 

-set dp- affects output (display of results). It has no effect on how
variables are interpreted on input. A variable that contains "12,3" will
be read in as string regardless of this setting. 

As several have pointed out, -destring, dpcomma replace- is a good fix
for that. 

Nick
[email protected] 

Kit Baum

Olga writes

My data contains commas as decimal points.
It looks like:

  RMR     EV      T
5,48    6,1   12,7
6,13      6   12,7

I want to destring it and replace comma with a period.


As Olga is coming from a part of the world where that is proper  
numeric punctuation, she should try

set dp period

and see what happens.  For instance, if I (with an Anglo-American  
version of Stata) do

set dp comma

>
>     Variable |       Obs        Mean    Std. Dev.       Min        Max
> -------------+--------------------------------------------------------
>         make |         0
>        price |        74    6165,257    2949,496       3291      15906
>          mpg |        74     21,2973    5,785503         12         41
>        rep78 |        69    3,405797    ,9899323          1          5
>     headroom |        74    2,993243    ,8459948        1,5          5
>


I see commas where I am accustomed to see periods (full stops).

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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