One answer is
replace problemvar = subinstr(problemvar, ",", ".",.)
but there is a better one.
The underlying problem is presumably a clash of conventions on decimal
points versus decimal commas.
There is discussion at
SJ-8-2 dm0036 . Stata tip 61: Decimal commas in results output & data
input
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N.
J. Cox
Q2/08 SJ 8(2):293--294 (no
commands)
tip on using commas as decimal separators for output
and input
In particular -destring, dpcomma- sounds like what you really want and
gets you there in one.
Nick
[email protected]
Ben Carpenter
I`d really appreciate if someone could help me with a little
string problem.
I want to replace commas "," by dots ".".
The "," occurs in different positions in the string such as
29,6
9,62
389,0
I`d like to convert this data to ...
29.6
9.62
389.0
(...in order to destring the data afterwards).
Could anyone help me with this replace problem?
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/