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]

st: RE: error 109


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: error 109
Date   Thu, 3 Feb 2011 19:21:33 +0000

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 
[email protected] 

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/


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