Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: New user question: integrating web page, Stata, and MySQL


From   kturner@stata.com (Kevin Turner)
To   statalist@hsphsun2.harvard.edu
Subject   st: Re: New user question: integrating web page, Stata, and MySQL
Date   Mon, 13 Nov 2006 09:36:19 -0600

Paul Bednar (PBednar@unch.unc.edu) writes:

>I'm a new Intercooled Stata 9.2 Windows user trying to integrate a web
>page, Stata, and MySQL.
>
>Here's the situation.  Using a web page, a user selects a date range to
>view actual, budget, and forecast data.  The actual and budget data is
>stored in a MySQL database and the forecast data is calculated in Stata
>using regression.  
>
>Is it possible for Stata to receive a request from either MySQL or the
>web page, run the regression and send the output to a MySQL table so the
>forecast data can be provided to the user?
>
>Perhaps I've misunderstood Stata's Data Management Manual, but odbc
>seems to go from Stata to MySQL, not the other direction.

Stata's ODBC implementation can write data to a data source as well as read 
it. You'll be interested in commands -odbc insert-, -odbc exec-, and 
-odbc sqlfile-.  

You could call Stata in batch mode from whatever scripting language you
are using. You would call separate instances of Stata with do-file
scripts in batch mode, have the do-file fetch the data, process it,
and then write it back to a database table before exiting. This is, of
course, a very high-level description of the solution and there are a
few issues that would need to be addressed before this will work
reliably, namely concurrency, potentially long runtimes, and making
sure you have an appropriate license from StataCorp before using
this for anything other than personal use.

--Kevin


Kevin Turner
kturner@stata.com
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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