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 on April 23, and its replacement, is already up and running.

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

Re: st: Stata 12 64bit odbc

From   Richard Palmer-Jones <>
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

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
program define exitprogram
exit, clear

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

* 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


On Tue, Oct 25, 2011 at 3:11 PM, Richard Palmer-Jones
<> 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
> ( 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:
> *
> *
> *

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index