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: Stata 12 64bit odbc
From
Richard Palmer-Jones <[email protected]>
To
[email protected]
Subject
Re: st: Stata 12 64bit odbc
Date
Tue, 25 Oct 2011 17:55:41 +0100
Dear Readers
let me offer a solution to my own problem - miss spent afternoon probably.
First I installed 32bit as recommended by Kevin Crow in
http://www.stata.com/statalist/archive/2009-12/msg00820.html
Then in Stata 12 MP 64 bit I write the following .ado file
"odbc32.ado" and put it on my search path
program define odbc32
syntax , odbcname(string) tablename(string) filename(string) path(string)
set more off
odbc list
odbc query "`odbcname'"
odbc load, table(`"`tablename'"') clear
save "`path'\\`filename'.dta", replace
exitprogram
end
program define exitprogram
exit, clear
end
/* I have to know the odbc name and the table name - the former is
what you uise when you define the odbc file. the latter is what "odbc
query "...." gives as the table name. In my case I am using .xls files
with several worksheets. Some of the worksheet names are not
transparent to me so I need to know them in advance from opening the
odpc file in stata 32
Bye the way It would be quite useful if "odbc query " returned the
table names but as far as I can see it returns nothing for "return
list"
*/
* then, in 64bit , I write
winexec C:\Program Files (x86)\Stata12\StataMP.exe -b odbc32,
odbcname(name of odbc file) tablename(name of table) filename(output
file) path(path to output file)
* and then use the output file
use "path to output file\output file", clear
Any suggestions for improvements of course welcome
Richard
On Tue, Oct 25, 2011 at 3:11 PM, Richard Palmer-Jones
<[email protected]> wrote:
> Dear Readers
>
> It seems Stata 12 MP 64 bit Windows 7 cannot read odbc files defined
> using c:\windows\sysWOW64\odbcad32.exe
>
> I came across the work around given for Stata 11
> (http://www.stata.com/statalist/archive/2009-12/msg00820.html) and was
> wondering if there were a more satisfactory soultion now. The problem
> with this work around (installing Stata 12 32 bit, loading the odbc
> data in 32 bit, saving and then loading it into 64 bit is that it is
> cumbersome especially if the odbc data gets updated over time. As a p
> rogram one has to pass over both the odbc name and the table name at
> least, and he code is not portable between 32 and 64 bit stata
> versions so that it cannot be shared with all colleagues.
>
> It would be nice to read odbc files directly into 64 bit Stata.
>
> Thanks for any help
>
> Richard
> *
> * 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/