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
Keep a group of observations if one record meets a certain conditionHi All, Here's an example of the sort of dataset that I'm working with: clear input studyid edvisi…
ksmirnov TestDear, Can I use ksmirnov one sample test for uniform distribution (see below)? ksmirnov X = unifor…
Break in consecutive values to identify groupsSuppose I have a dataset like this: clear set obs 20 gen x = 1 gen id = 1 in 1/10 replace id = …
Discrete choice experiment : WTP with effects codingHello, I'm afraid this is not strictly a stata question. I have conducted a Discrete choice experime…
Tabout and Fre suddenly not working?For some reason when I export frequency tables to excel and/or word (as .csv or .rtf files), they ar…
Subscribe to:
Post Comments (Atom)
0 Response to Adding columns with loop
Post a Comment