Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Data management


From   "Scott Merryman" <[email protected]>
To   <[email protected]>
Subject   st: RE: Data management
Date   Tue, 13 Feb 2007 18:25:48 -0600

clear
input x y
1 10
2 12
3 2
4 1
5 10
end
egen sum = sum(y)
gen z = y/(sum - y)
l

Scott


> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Roy,Suryadipta
> Sent: Tuesday, February 13, 2007 5:44 PM
> To: [email protected]
> Subject: st: Data management
> 
> Hi,
> 
> I am trying to generate a new variable for the following
> form of data:
> id      var
> 1	A
> 2	B
> 3	C
> 4	D
> 5	E
>         =sum(A+B+C+D+E)
> 
> I am trying to generate a third column where the 1st
> observation= A/(B+C+D+E); 2nd observation= B/(A+C+D+E),
> and so for all the five observations. Any help will be
> highly appreciated. I am wondering if I need to do some
> programming in such cases; so any guidance in this
> direction (so that I might be more self-sufficient
> henceforth) will be very helpful.
> 
> Thanks!
> Suryadipta.



*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index