Hi all,
I please have another question.
So I have variables Revenue_GDP, Expenditure_GDP, Consumption_GDP, GovernmentConsumption_GDP, Investment_GDP, Exports_GDP Imports_GDP, Debt_GDP, Deficit_GDP
which are all as a % of GDP. I am trying to generate for example Revenue = Revenue_GDP * GDP_LCU to get Revenue figure and likewise for all the above variables.
I tried the following loop but it gives me error saying Revenue_GDP is already defined
The formula I am using:
local vars3 "Revenue Expenditure Consumption GovernmentConsumption Investment Exports Imports Debt Deficit"
local vars4 "Revenue_GDP Expenditure_GDP Consumption_GDP GovernmentConsumption_GDP Investment_GDP Exports_GDP Imports_GDP Debt_GDP Deficit_GDP"
foreach x of varlist `vars3' {
foreach s of varlist `vars4' {
gen `x' = `s' * GDP_LCU
}
}
Can you help me correct it. Thanks.
Related Posts with Foreach loop
Interpretation formulas of Poisson regression coefficient formula for percentages and logsDear Statalist members, I have done a Poisson fixed effects panel regression (Stata 13) regressing …
Overlay predicted probabilities from separate logistic regressionsI would like to overlay predicted probabilities from two separate logistic regressions. My outcome o…
Stripping a variable of another's effect (or Fama-MacBeth regressions)Hello everyone, I have time series data with over 1000 daily observations regarding financial asset…
Command for Listwise deletionI am doing linear regression and my IV has more cases than my DV so our instructor told us to do lis…
Print out matrix values in the process of Mata functionHello all, I was trying to print out intermediate matrix results in order to debug my Mata function…
Subscribe to:
Post Comments (Atom)
0 Response to Foreach loop
Post a Comment