Good morning
I open this thread to ask if in Stata it is possible to create initial parameters (to change them according to requests).
To explain myself better, I give a practical example.
This is my initial situation:

Code:
forvalues i = 1/7 {
gen CAPINV`=2012+`i'' = 0
foreach j of numlist 214(7)269 {
replace CAPINV`=2012+`i'' = CAPINV`=2012+`i'' + v`=`j'+`i''
}
}

forvalues i = 1/7 {
gen D`=2012+`i'' = 0
foreach j of numlist 248(7)269 {
replace D`=2012+`i'' = D`=2012+`i'' + v`=`j'+`i''
}
}
Come vedete il numero 7 appare quattro volte (nei due forvalues e nei due foreach).
Vorrei creare un parametro (ad esempio x=7) che mi permettesse di cambiare quel determinato numero solo una volta. Ad esempio:

x=7
Code:
forvalues i = 1/x {
gen CAPINV`=2012+`i'' = 0
foreach j of numlist 214(x)269 {
replace CAPINV`=2012+`i'' = CAPINV`=2012+`i'' + v`=`j'+`i''
}
}

forvalues i = 1/x {
gen D`=2012+`i'' = 0
foreach j of numlist 248(x)269 {
replace D`=2012+`i'' = D`=2012+`i'' + v`=`j'+`i''
}
}
or
x = 8
Code:
forvalues i = 1/x {
gen CAPINV`=2012+`i'' = 0
foreach j of numlist 214(x)269 {
replace CAPINV`=2012+`i'' = CAPINV`=2012+`i'' + v`=`j'+`i''
}
}

forvalues i = 1/x {
gen D`=2012+`i'' = 0
foreach j of numlist 248(x)269 {
replace D`=2012+`i'' = D`=2012+`i'' + v`=`j'+`i''
}
}
So directly change the number only in the paramtero without having to change it in all the formulas (here I have reported only two formulas, but I have several as well). is this possible in Stata (similar to Matlab)? Thanks!