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

st: eliminating the nth digit of a numeric variable

From   "Sanz De Galdeano, Anna" <>
To   "''" <>
Subject   st: eliminating the nth digit of a numeric variable
Date   Wed, 26 Feb 2003 22:09:39 +0100

Dear Stata users,

I have a numeric variable which takes, for instance, values like:


As you see, all these numbers have one thing in common: the third difit
starting from the right is always 0. That 0 should not be there and I want
to get rid of it so that my numeric variable looks like:


I think I could get what I want by using decode to transfor my numeric
variable into a string variable and then use some of the string functions
and/or some of the egen options for strings.
I guess (although I did not work it out) I could also use an algorithm. But
I have run into similar problems in the past and I would like to know
whether there is any stata routine that can be used (something similar to
what the string functions do, but for numeric varriables instead) to get the
desired result faster.

Thanks a lot in advance,

*   For searches and help try:

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