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

Re: st: Adding a new variable to update a class of observations


From   David Kantor <[email protected]>
To   [email protected]
Subject   Re: st: Adding a new variable to update a class of observations
Date   Tue, 08 Mar 2005 17:05:05 -0500

To Robin Newberry,

How big is this spreadsheet that tracks the changes? What form is it in -- wide or long? Do you have it as a Stata dataset?

If the changes are small in number, then you can write some generate/replace expressions to do what you want. Otherwise, you need to put the "spreadsheet that tracks these changes" into a Stata dataset in a sufficiently-organized form. It should have a variable with all the various department identifiers (which ought to be unique-valued), and another with the "condensed" identifiers (one value for each actually-distinct department). Then merge this to your main dataset.

You mentioned two variables -- a department name and a department number. The operation I sketched should apply to only one of these -- at least in terms of the match key. Presumably, the name is functionally dependent on the number, making for non-normal data; you may want to factor out the department name.

HTH,
-- David

At 04:12 PM 3/8/2005 -0500, you wrote:

I have some variables which denotes a sub-set of observations in the injury data which groups employees working together; typically there's a "department name" and a "department number". The issue is that the names and numbers identifying these categories have changed repeatedly over the last 15 years. An employee may have started out working in "Department A" progressed through departments B, C, and D without ever actually changing jobs, supervisors, etc. - all that's changed is the nomenclature. I don't believe we've ever duplicated and inadvertently renamed "Department A" to "Department D", then later renaming another group "Department A".

Somewhere we have a spreadsheet that tracks these changes, and I'd like to incorporate the changes to more or less normalize the data; that way I can track injuries amongst the folks who mow the grass, regardless of what their department is called. Is there a way to add a new variable, and equate it to an existing one?
--
Robin
--------------------------------------------------------------
W. Robert Newberry, IV CIH, CHMM
Chief Environmental Health and Safety Officer
Clemson University

[email protected] [email protected]
http://ehs.clemson.edu/
David Kantor
Institute for Policy Studies
Johns Hopkins University
[email protected]
410-516-5404
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index