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/