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

st: Re: From: "Adolf Mkenda" <[email protected]>

From   "R.E. De Hoyos" <[email protected]>
To   <[email protected]>
Subject   st: Re: From: "Adolf Mkenda" <[email protected]>
Date   Tue, 19 Jul 2005 19:35:01 +0300


tostring myvar, gen(mystr) format(%14.0f)
gen myvar2 = substr(mystr,6,1)


----- Original Message ----- From: <[email protected]>
To: <[email protected]>
Sent: Tuesday, July 19, 2005 7:21 PM
Subject: st: From: "Adolf Mkenda" <[email protected]>

I am trying to isolate some digits from a variable to form a new variable.
For example, I have a variable with 13 digits (e.g. 5101232120011) and I
want to extract the 6th digit (in this case 3) and make it a separate
variable. The original variable always has 13 digits in it. I wonder
whether I can use Stata to do this. I will appreciate suggestions.
Adolf Mkenda
Dar es Salaam.
*   For searches and help try:

*   For searches and help try:

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