Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: odbc load from SQL if ID is in my Stata master dataset?


From   Jen Zhen <[email protected]>
To   [email protected]
Subject   st: odbc load from SQL if ID is in my Stata master dataset?
Date   Tue, 18 Sep 2012 13:46:59 +0200

Dear list members,

I have a list of person ID numbers for whom I would like to merge in
information from a large SQL dataset (containing the IDs in the first
list, plus many more).

I assume that I cannot directly merge in from the SQL dataset, but
must first load the SQL dataset into Stata, save as dta, and then I
can merge that into my main dataset.

However, I'm wondering how, when loading from SQL with --odbc load-- I
can best specify that I'm only interested in observations with a fixed
list of ID numbers?

What would work is to write "WHERE id=51 OR id=332 OR ...", but since
I have several hundred valid IDs this seems inefficient.

Would anyone happen to know a better way?

Thanks so much and best regards,
JZ
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index