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

st: Doubt about Index


From   "Rodrigo Brice�o" <[email protected]>
To   "Statalist \(E-mail\)" <[email protected]>
Subject   st: Doubt about Index
Date   Fri, 10 Jan 2003 13:44:33 -0600

Hello friends of the list. I have a variable called rg which contains a
large amount of numbers that represent certain income categories:

    1.       01.01.01
    2.       01.02.01
    3.       01.02.04
    4.    01.01.02.01
 and so on.  I wan to extract the first two numbers in order to construct a
new variable that tells me the main categories of income, so I will have 01,
02, 03 and 04. My variable is a string, so I think that I can use the substr
function (gen rg1=substr( rg, 1,2)), but I'm getting some error 109 that
talks about the inconsistency using numbers as strings. How can I solve
this?

Thanks for your time.

Rodrigo



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