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: RE: Creating new observations


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: RE: Creating new observations
Date   Tue, 15 Jun 2010 19:50:04 +0200

<>

This can be done, but is unusual and rare:

***********
clear*

inp str1 Country	byte(Income Population)
A			5				5
B			3				3
N			3				3
end

set obs `=_N+1'


replace Country=Country[1]+"+"+Country[2] in l
replace Income=Income[1]+Income[2] in l
replace Population=Population[1]+Population[2] in l

list, noo
***********


HTH
Martin

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Ida Johnsson
Sent: Dienstag, 15. Juni 2010 19:37
To: [email protected]
Subject: st: Creating new observations

Hi!
I am new to Stata and have the following problem. How do I create new  
observations if I have panel data, for example

Country		Income			Population
A			5				5
B			3				3
...			...				...
...			...				...
...			...				...
...			...				...
N			3				3


and want to add observations that are grouped values for certain  
countries, for example

Country		Income			Population
A			5				5
B			3				3
...			...				...
...			...				...
...			...				...
...			...				...
N			3				3
A+B			8				8



Thanks a lot!

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

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