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, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"M.P.J. van Zaal" <Matthias.vanZaal@student.uva.nl> |

To |
statalist@hsphsun2.harvard.edu |

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/

**Follow-Ups**:**Re: st: Creating a variable from several "subvariables"***From:*Mitch Abdon <mitchaabdon@gmail.com>

- Prev by Date:
**Re: st: possible bug in reclink?** - Next by Date:
**Re: st: Creating a variable from several "subvariables"** - Previous by thread:
**Re: st: possible bug in reclink?** - Next by thread:
**Re: st: Creating a variable from several "subvariables"** - Index(es):