Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: stat transfer

From   Steven Dubnoff <>
Subject   st: Re: stat transfer
Date   Sat, 05 Oct 2002 11:59:28 -0700

The best way to handle ODBC connections to databases (including SQL Server) from within Stata, is to put a series of dbr or dbw (database read/database write) commands in a Stat/Transfer command file. For instance:

dbr datasource myoracle
dbr user scott
dbr password tiger
dbr table employee
copy odbc temp.dta

If the file were saved as, you could run it with stcmd as:


It is particularly handy to use the ODBC driver to prompt you for password and other connection information and then save the "connection string" in encrypted form for later re-use, as in:

dbr connstr <# saved.dat

which can replace everything above except the "dbr table" and copy commands.

All of this is explained in greater detail in the command processor documentation, particularly the section, "Running Batch Jobs with ODBC".



Steven Dubnoff
Circle Systems We make your data instantly usable.
Download Stat/Transfer from
1001 Fourth Avenue, #3200 (206) 682-3783
Seattle, WA 98154 Fax (206) 328-4788

* For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index