|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Using data from other dataset for -gen-
Dear Statalisters,
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.
Any idea how to solve this?
Thanks a lot.
Marc
iFQ
Institut für Forschungsinformation und Qualitätssicherung
Godesberger Allee 90
53175 Bonn, Germany
Tel.: *49 - 228 - 9 72 73 - 25
Fax: *49 - 228 - 9 72 73 - 49
E-mail: [email protected]
www.forschungsinfo.de
*
* 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/