Hi dear member,
I am a beginner in the use of foreach. I need help to execute this code:
foreach var in eyrs_mf nostu_mf asr_mf {
gen d10_`var' = `var' - L10.`var'
su d10_`var' if year==2015, detail
scalar p50d`var' = r(p50)
scalar p75d`var' = r(p75)
}
When I execute the code above, I get the following error message:
. foreach var in eyrs_mf nostu_mf asr_mf {
2. gen d10_`var' = `var' - L10.`var'
3. su d10_`var' if year==2015, countrynumber
5. scalar p50d`var' = r(p50)
6. scalar p75d`var' = r(p75)
7. }
not sorted
r(5);
end of do-file
r(5);
I tell myself that the problem is located in this code «gen d10_`var' = `var' - L10.`var». My variables are ranked from 1950 to 2015 with missing data. I used a panel data. Even when I used xtset and try to sort using "bysort countrynumber eyrs_mf nostu_mf asr_mf: list wbcode" I always get the same error message. Thanks for your help
Related Posts with Problem with foreach
sureg with standard errorsDear all, I use sureg to run regressions on 5 equations. The default from sureg command is t statis…
%e formatHi, I'm confused with the definition of %e format. I'm doing IV regression for panel data. I used …
How to proceed with variables with Unit Root or non stationarity using fixed effects estimation??I have a data set of N=280 and T =60. I did fisher test for each of my 9 variables. Only two have un…
How to plot wages by country , but for each country plot overlaid men and women wages?Suppose I want to plot wages of women and men by country. How can I do that? female and male wages a…
How to add inequality constraints to gologit2 modelHow can I run a constrained gologit2 model with inequality constraint ( Beta of x1 <= Beta of x2)…
Subscribe to:
Post Comments (Atom)
0 Response to Problem with foreach
Post a Comment