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: Loading long string variables (from SQL) into Stata


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Loading long string variables (from SQL) into Stata
Date   Tue, 4 Sep 2012 14:23:54 +0100

The maximum length of string variable in all current variants of Stata
is 244. See e.g. -help limits- or

http://www.stata.com/help.cgi?limits

That cannot be changed.

You could split a long string using Mata, but you'd still have to
import it somehow. Better to split it within your data source.

Nick

On Tue, Sep 4, 2012 at 2:14 PM, Jen Zhen <[email protected]> wrote:

> I`m loading some variables from an SQL database into Stata using the 2
> lines of code given below.
> One of them is a very long string variable that gets cut off when
> loaded into Stata. Is there a way to either increase the maximum
> length of string variables allowed in Stata, or to automatically split
> each string at whatever is the maximum number of symbols and put the
> rest into further string variables?
> Thanks so much and best regards,
> JZ
>
> local sql "SELECT var1, var2, var3 FROM database WHERE var1>5"
> odbc load, exec("`sql'") conn("`db'")
*
*   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