Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[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" <>
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 

"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!

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index