Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Creating a variable from several "subvariables"
From
"M.P.J. van Zaal" <[email protected]>
To
[email protected]
Subject
st: Creating a variable from several "subvariables"
Date
Sat, 04 Dec 2010 13:43:10 +0100
Dear Statalist users,
For my research I have determined the value of a variable in 12
scenarios.
"gen x_1= "input function and values" if scenario1==1"
Each scenario's values differ in some aspect.
I have now 12 variables, x_1 to x_12, each with n=+/- 500.
For the next step I would like to create a new variable which
incorporates x_1 - x-12.
The variable would be something like "x_total= x_1+x_2+....+x_12",
with n=+/-6000.
I tried to simply add them with the use of the generate command but
this did not work. I also tried to use egen with the sum command, but
this also did not work.
What would be the correct way to create "x_total" in STATA?
Many thanks!
Mathijs
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/