Hi Statalist,
I frequently use the odbc load, exec command to import SQL table data from do-files, but today I have run into an issue where Stata does indeed read the table into memory, then displays the do-file commands in the results window, but Stata fails to actually execute any of the subsequent commands.
The form of the command used is
Code:
clear odbc query "database" , user(user) password(password) #delimit ; odbc load, exec (" SELECT * FROM table ") dsn("database") ;
Stata does not throw an error; it just treats the remaining commands as if they were commented out using /* stuff */
I can run the do file manually after the data loads with no errors, so I am wondering if it's a data memory issue whereby Stata doesn't fully load the data into memory before some other parallel process moves on to the commands. The underlying data table is about 7500 observations with about 50 variables, so it does take some time to load up. I am also not sure what, if any, role the use of the pound-delimit preprocessor command may play.
I searched for this issue on the Statalist but didn't find anything. I am not looking for debug help as I realize that this issue is not reproducible without the SQL credentials to my actual database and the actual do-file commands (which are few and very basic as I just started the file today), but I am hoping someone out there might know what could be happening under the hood and/or how I could add some code to my do-file make sure the ODBC import is fully processed before processing the next commands (if that is even what might be the issue).
I always learn something new here, so I appreciate any insights.
0 Response to Do-file stops processing commands following ODBC SQL SELECT loading
Post a Comment