Hello, I'm having issues with the following.
I have 4 variables x1, x2, x3, x4 each one with 10 observations
I need to create a variable new_variable = x1+x2+x3+x4 with help of foreach command. I know it is straightforward using gen new_variable = x1+x2+x3+x4 but I can't achieve it using foreach.
Thanks
Related Posts with Adding columns with loop
Summing the values over specific range of variablesHello. I have a dataset on weekly hours that individuals worked for each week of the years. For exa…
Lambert functionHi everyone, I would need to compute the Lambert function W(a) in Stata, but I cannot find a command…
Problem with multigroup SEMHello, I'd like to know what is the code for estimating the indirect effects in multigroup SEM. Fo…
Margins postHi all, I have the following problem: using the margins plot command to look at the graph between my…
Lagged response modelDear Statalisters, I am using a longitudinall dataset in which my main outcome is "QI score" (measu…
Subscribe to:
Post Comments (Atom)
0 Response to Adding columns with loop
Post a Comment