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
Rangestat to regress multiple values in panelHello everyone, I have a panel along the variables Dates and gvkey and am trying to calculate the v…
command kpss is unrecognisedHello I have trying to test for stationarity using Kwiatkowski–Phillips–Schmidt–Shin test. But the …
how to deal with two datasetsHi! I have a dataset with information on applicants to all job vacancies in an organization, for ea…
Inverted u-shaped relation: how to deal with a moderatorHi all, I've found an inverted u-shaped relation between the dependet variable "roa" and the variab…
how to square a standardized log variable and build interaction term?Hello everybody, I have a question simply to the way of how to calculate something: I have variabl…
Subscribe to:
Post Comments (Atom)
0 Response to A function for a number
Post a Comment