Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

RE: st: Loading long string variables (from SQL) into Stata


From   tashi lama <ltashi32@hotmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Loading long string variables (from SQL) into Stata
Date   Tue, 4 Sep 2012 13:41:16 +0000

I would also like to find the answer. There is _compress but I am not sure it will be any help since the columns are already truncated before it loads. _compress seems to be helpful once the columns are successfully loaded and you want to save the memory. By the way, if you are running stata in unix, did you have any problem loading sql columns with type varchar? I am having an issue while loading columns with type varchar. 

Thanks,
Tashi 
----------------------------------------
> Date: Tue, 4 Sep 2012 15:14:43 +0200
> Subject: st: Loading long string variables (from SQL) into Stata
> From: jenzhen99@gmail.com
> To: statalist@hsphsun2.harvard.edu
>
> Dear listers,
>
> 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/ 		 	   		  
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index