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

st: Referencing Specific Cell in Panel Data


From   Jason Hwang <[email protected]>
To   [email protected]
Subject   st: Referencing Specific Cell in Panel Data
Date   Thu, 4 Nov 2004 21:08:23 -0500 (EST)

Hi,

I have panel data of the following form:

country	year	index
1	1990	97
1	1991	103
1	1992	107
2	1990	102
2	1991	112

I want to be able to say: if the value of the "index" variable in 1990 was
greater than, say, 100, then I want to create an indicator variable=1 for
that country for all years. How would I do this? I can't do something like

gen indicator=1 if year==1990 & index>100

since this would apply only to 1990 and not the other years. How do I
reference a specific country-year cell when I want to use the reference in
a command that applies to the entire dataset?

(a way other than the brute force method which would keep only 1990,
creating the indicator variable, save as a separate file, then merge it
back to the original data.)

Thanks for your help!

Jason
*
*   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