Bookmark and Share

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]

Re: st: Creating a variable from several "subvariables"


From   Mitch Abdon <[email protected]>
To   [email protected]
Subject   Re: st: Creating a variable from several "subvariables"
Date   Sat, 4 Dec 2010 20:52:08 +0800

egen x_total=rsum(x_1-x_12)    //assuming that the variables are in order

On Sat, Dec 4, 2010 at 8:43 PM, M.P.J. van Zaal
<[email protected]> wrote:
> 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/
>



-- 
Best,
Mitch


Arnelyn Abdon
+639178034402
http://statadaily.wordpress.com
http://www.facebook.com/pages/Stata-Daily/116477895082525

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index