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: odbc load a large table, hitting max obs limit


From   "Dimitriy V. Masterov" <[email protected]>
To   [email protected]
Subject   Re: st: odbc load a large table, hitting max obs limit
Date   Thu, 6 Sep 2012 14:31:30 -0700

Tashi,

You should not use another thread to ask your related questions. It's
distracting and messes up the archiving.

However, I am feeling nice today, so I am going to violate that rule.
You need to recast the varchar variable as something that Stata can
understand. This should look like this:

odbc load, exec("select readership_id read_date cast(doc_title as
char(244)) from readership;") dsn("indigo") sqlshow

compress

Loosely, varchar is a string of indeterminate length. This format is
useful when you have strings of very different length, so storing them
as a fixed length string is inefficient. Stata does not allow such
luxuries, so I am converting doc_title to a 244 character string, but
compressing after to something shorter.  If you pick something too
short, like char(1), SQL might complain that you're truncating it on
the right. 244 is the limit in Stata, so if your doc_titles are ever
longer, you will need to split that variable into 2 or more manageable
variables using SQL. If you can't figure how to do that with the help
of Dr. Google, try asking at http://stackoverflow.com/. Statalist is
not the best place for such queries.

DVM
*
*   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