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

Re: st: Splitting a string variable


From   Richard Goldstein <[email protected]>
To   [email protected]
Subject   Re: st: Splitting a string variable
Date   Mon, 17 Oct 2005 09:55:51 -0400

gen str newvar=substr(oldvar,1,4)

The above assumes that all data are like the one example you gave

Mosca, Ilaria wrote:
I am dealing with a string variable that has 4 figures and 2 letters,
something like this: 1234AB
As you can see there is no space, or comma, etc. divinding the figures
from the letters. What I wanna do is to create a new variable where I only keep the
figures and drop the letters. How can I do that? Does the command SPLIT
help me in this?
Thank you very much.

Ilaria
*
*   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