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

st: ODBC sqlfile question


From   "Grealy, Patrick" <PGrealy@sph.uth.tmc.edu>
To   "Statalist (E-mail)" <statalist@hsphsun2.harvard.edu>
Subject   st: ODBC sqlfile question
Date   Wed, 21 Apr 2004 18:12:04 -0500

Hi,
I'm trying to learn the _odbc_ command and hit a problem. I'm using current update  of Stata 8.2 in Windows XP. I've gotten the following to work fine:

odbc load, exec("select A.TCENTER, A.PNUM, A.RCENTER, sex=F01076, rzgrp=f80049 from al001 A inner join al080 B on (A.TCENTER=B.TCENTER) and (A.PNUM=B.PNUM) and (A.RCENTER=B.RCENTER) ") dsn(al)

tab sex rzgrp;

But, if I create file test.sql containing:

select  A.TCENTER, A.PNUM, A.RCENTER, 
     sex=F01076, rzgrp=f80049 
     from al001 A inner join al080 B on 
     (A.TCENTER=B.TCENTER) and (A.PNUM=B.PNUM) and 
     (A.RCENTER=B.RCENTER);

and then try:

odbc sqlfile("test.sql"), dsn(al)

it seems to run without error but I have no data loaded. What am I missing?

I'm not too hot with SQL but would like to be able to put the _select_ statements in a separate file since they are sometimes long and complicated.
Thanks,
Pat G.

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