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/