Hello and sorry if this has been asked elsewhere; I couldn't seem to find the right way to phrase my question.
Basically, I am interested in calculating the per capita funding received by a county for a specific project. For each project, I have information on the project fiscal year. I also have the county population for all years over which projects were funded. The population for each year is stored under the variables pop1980, pop1981, pop1982, etc. What I would like to do is use the project fiscal year to determine which population variable is used to calculate the per capita value. So, for example, if a project was conducted in FY 2001, then I would like for the per capita project value to be calculated as project_cost/pop2021. I don't know if there is a way to do this in a single command. In my mind it would be something like
, but I don't know if this is overly simplified. I've attached the data for reference.
Thanks!
Basically, I am interested in calculating the per capita funding received by a county for a specific project. For each project, I have information on the project fiscal year. I also have the county population for all years over which projects were funded. The population for each year is stored under the variables pop1980, pop1981, pop1982, etc. What I would like to do is use the project fiscal year to determine which population variable is used to calculate the per capita value. So, for example, if a project was conducted in FY 2001, then I would like for the per capita project value to be calculated as project_cost/pop2021. I don't know if there is a way to do this in a single command. In my mind it would be something like
Code:
gen per_cap_cost = project_cost/pop[the output of programfy for that observation]
Thanks!

Comment