Statalist


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

st: RE: Using data from other dataset for -gen-


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Using data from other dataset for -gen-
Date   Fri, 29 Jan 2010 12:24:43 -0000

If you read in dataset 2, apply -levelsof-, and then read in dataset 1,
the -local- will still be defined. 

Otherwise an FAQ by Kit Baum 

http://www.stata.com/support/faqs/data/characteristics.html

may be of value. 

Nick 
[email protected] 

Kaulisch, Marc

I have a problem I am not able to solve and it might be that someone
else has a good solution at hand (using Stata 10 or 11).

My aim is to generate variables indicating if a person is in a certain
context.
Dataset 1 looks like
Person_id context1 context2 context3 context4 context5

The context*-variables contain numerical values that identify certain
institutions (institution_id). The real meaning/names of the
institutions is given in the Dataset 2:
Institution_id short_name abbreviation institution_nr

At the end I would like to do the following for each in Dataset 1:

. egen co`institution_nr' = incss(context*), sub(`institution_id')
. la var co`institution_nr' "Recent context `abbreviation' `shortname'"

But how do I get the information I need to do this in Dataset1 from
Dataset 2?

I tried to do this with generating locals from dataset 2:
. levelsof institution_id, local(institution_id)

But then I loose the right connection between institution_id and the
other vars in dataset2.

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index