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: ODBC import


From   Janet Hill <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: ODBC import
Date   Fri, 13 Dec 2013 16:57:16 +0000 (GMT)

I need to import some large tables from Access 2013 to Stata 13.1 and I have been using the following command:
clear
odbc load,exec(`"SELECT Demographics.*, Visit.* FROM Demographics INNER JOIN Visit ON Demographics.Hospid = Visit.HosPid"')///
lower allstring connectionstring(`"Driver=Microsoft Access Driver (*.mdb, *.accdb);DBQ=C:\Students\September.accdb"')

This fails with the error:
hospid already defined
r(110);

and this occurs because Stata does not prefix the column name with the table name. I can explicitly add each table.column, which works on a small dataset,but because there are 15 columns in one table and 30 in the other this becomes unwieldy and prone to typing errors. Other tables may be larger.

I would be grateful for any suggestions on how to solve this problem.

Many thanks,
Janet

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


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