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]

st: Insert sum of column values by id as new observation


From   "Mike Kim" <[email protected]>
To   <[email protected]>
Subject   st: Insert sum of column values by id as new observation
Date   Wed, 22 Dec 2010 23:24:54 -0600

Hi All,

My data looks like the following and I would like to create sum of wk1ad
wk2ad... by id and insert as new observations.

id	wk1ad		wk2ad	 ...
1	10		10
1	20		10
2	10		20
2	10		20
2	20		10
3	10		20
.....

The resulting data I want to have is the following. How can I do this work
in Stata?

id	wk1ad		wk2ad	 ...
1	10		10
1	20		10
1	30		20   <- newly created obs
2	10		20
2	10		20
2	20		10
2	40		50   <- newly created obs
3	10		20   <- do not need to create obs
.....

Thank you in advance.
Mike.


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