Statalist


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

st: Re: ODBC - Access files


From   "Joseph Coveney" <[email protected]>
To   <[email protected]>
Subject   st: Re: ODBC - Access files
Date   Wed, 29 Jul 2009 11:44:50 +0900

Martyn Sherriff wrote:

Many thanks for your help. I can now read the Access files. I just assumed that 
I would need extra quotes for the space in the directory name.

--------------------------------------------------------------------------------

I'll take this opportunity to redeem myself:  you don't need to worry about 
ending the SQL statement with a semicolon when using -#delimit ;-.  The SQL 
statement is enclosed in quotation marks just like the DSN connection statement 
is, and so Stata will ignore its semicolon just as it does those in the DSN.

local dsn MS Access Database;DBQ=<filename>.accdb;DefaultDir=<directory>\;
#delimit ;
odbc load, exec("

    SELECT G.* FROM Selections AS S 
     LEFT JOIN GeneralSummary AS G 
     ON S.clinic_id = G.clinic_id AND S.patient_id = G.patient_id;

	") dsn("`dsn'") clear;
assert !mi(clinic_id);
#delimit cr

will work.

Joseph Coveney



*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index