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]

Re: st: load additional variable in stata


From   Maarten Buis <[email protected]>
To   [email protected]
Subject   Re: st: load additional variable in stata
Date   Thu, 31 Oct 2013 13:17:24 +0100

On Thu, Oct 31, 2013 at 12:58 PM, Michael Stewart wrote:
> I am working with large  dataset and it takes a while to load the
> dataset. Hence, I have resorted to using relevant variables by stata
> commands
> use varlist using xxx.dta
>
> My question: One I have loaded lets say var1 var2 var3 into stata ,
> how is it possible to load one additional variable into stat memory
> without clearing the memory.

Here is an example. The key part is that you need an id variable, so
Stata knows which observations belong together. In the auto dataset
this is the variable make. If you did not include your id variable
when you originally opened your dataset, then there is not much that
can be done. The `c(sysdir_stata)' part may look weird, but it is just
the directory in which the auto.dta example dataset is stored. By
doing it this way the example will work regardless of where Stata was
installed on your system.

*------------------ begin example ------------------
use make price using `c(sysdir_stata)'auto.dta
merge 1:1 make using `c(sysdir_stata)'auto.dta, ///
    keepusing(foreign)
*------------------- end example -------------------
* (For more on examples I sent to the Statalist see:
* http://www.maartenbuis.nl/example_faq )

Hope this helps,
Maarten

---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany

http://www.maartenbuis.nl
---------------------------------
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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