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

st: duplicating values within one variable

From   Gregor Franz <>
Subject   st: duplicating values within one variable
Date   Mon, 21 Nov 2005 03:31:54 -0800

This seems to be a rather simple problem, but I just can't think of a way for it to work.

How can I make observations in a variable take on the value of a specific observation within this variable? For example, I have employees by industry in each county in each state for several years. I want to create a variable that is equal to employees in industry = x for each county and state by year for all observations. If I type gen test= employees if industry ==x, I only get one observation each year, by county and state, but I want the rest of the (now missing) obesrvations in variable 'test' (which in the original variable 'employees' take on the values by different industries) to take on the value of industry x. So in the end all observations for the variable 'test' would take on the value of industry county state and year.

If this turns out to be really simple my only defense is that it is late.

Thanks again!
* For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index