Hi, I am writing a loop that looks like this
foreach code of numlist 1/202{
forvalues i=1940/2020{
forvalues j=0/4{
summ y`i'q`j' if id==`code' & inlist(indicatorcode,"A", "B", "C", "D")
replace y`i'q`j'=r(sum) in 2*`code'-406
summ y`i'q`j' if id==`code' & inlist(indicatorcode,"X", "Y", "Z")
replace y`i'q`j'=r(sum) in 2*`code'-405
}
}
}
There is a problem with the replace command as STATA can't understand 2*`code'-406 where it is written. How do I make this work?
So essentially, when writing a command
replace newvar = exp in #
how can I make # into a function using a variable from foreach?
Related Posts with A function for a number
ineqdec0, missing values and error in loopHi everyone, I am trying to export a large number of descriptive statistics on household income by c…
Panel data - constant dependent variable across individuals not timeHello, I wanted to seek for someone's advice as I have run into a number of problems with my analys…
gllamm, ... thresh() to model continuation-ratio logit model (seqlogit with random terms)Dear all, I am trying to fit a continuation-ratio logit model in a multi-level context. I have an o…
Save results from the first stage in ivprobitHello! I am doing : ivprobit any $GR_geo ( gdp_perc = $x_eco $x_eco_lag_1 ), twostep first estimate…
graph quadratic relationship with binary moderatorHey everybody, I found the following graph in a paper and would like to recreate the exact same gra…
Subscribe to:
Post Comments (Atom)
0 Response to A function for a number
Post a Comment