Hello,
I have a wide dataset which contains the birth year of various persons as well as the GDP for various years, as in: birthyear, gdp1990, gdp1991, gdp1992...
Suppose I want to create a new variable which is the average of the gdp for the three years when a person was 8, 9 and 10 years old. I would normally use egen / rowmean, but I can't figure out a simple way to indicate to Stata which 3 variable to average (as they would differ depending on the value of birthyear).
If anyone can suggest a simple and/or elegant way to do this, I would highly appreciate it. I can only think of some very inefficient and inelegant ways of doing it.
Thanks,
'Alim
Related Posts with Selecting variables based on the value of another variable
Invalid Syntax when calling for local variableHello, I am getting an invalid syntax error when I am try the following: I want ci to be summed only…
Looking for a way to save sums and load into a table similar to estimate tableI apologize if this has been asked before, but I looked around and couldn't find an answer. For a r…
Tabulate With Weights In StataI have a variable "education" which is 3-level and ordinal and I have a binary variable "urban" whic…
Hypothesis Test on Goodman-Kruskal Gamma StatisticHi---looking for some help with whether there is an option to run a hypothesis test/compute a p-valu…
Chow testTwo regression equations are like this: Tobin q = dominant owner CEO + dominant owner CEO * board ab…
Subscribe to:
Post Comments (Atom)
0 Response to Selecting variables based on the value of another variable
Post a Comment