Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: RE: error 109


From   Natalia Batista <nbatista@usp.br>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: error 109
Date   Thu, 03 Feb 2011 17:26:28 -0200

thanks
--
Natalia Batista
University of Sao Paulo at Ribeirao Preto
Department of Economics
tel +55 16 3602 0506 (office)
fax +55 16 3633 4488



Citando Nick Cox <n.j.cox@durham.ac.uk>:

In your context -string()- maps numeric variables to string. It takes a variable across the big divide. But if you're already across, it is not needed and indeed illegal.

Your request needs to be rephrased. The idea of the first 8 numbers of a string makes no sense to Stata. You want the first 8 characters, which no doubt are numeric characters in your case, but that needs a different function.

Anyway, it should be easy. Try

gen id_v3 = substr(v3, 1, 8)

Nick
n.j.cox@durham.ac.uk

Natalia Batista

I´m tring to create a string variable (id_v3) from another string
variable (v3). But I want just the 8 first numbers. I tried the
following:
generate str id_v3 = string(v3,"%-08.0f")

By it did not worked. I got the error 109: type mismatch

How can I solve it?


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/




*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index