|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: Data manipulation
egen diff = min(abs(incpc - 500))
gen flag = (abs(incpc - 500)) == diff
______________________________________________
Kieran McCaul MPH PhD
WA Centre for Health & Ageing (M573)
University of Western Australia
Level 6, Ainslie House
48 Murray St
Perth 6000
Phone: (08) 9224-2140
Phone: -61-8-9224-2140
email: [email protected]
http://myprofile.cos.com/mccaul
_______________________________________________
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Ana R. Rios
Sent: Wednesday, 23 July 2008 12:58 PM
To: [email protected]
Subject: st: Data manipulation
Stata users,
I would like to obtain the incpc that is closest to x value. For example, if x=500 the incpc will be 360.
househol incpc obs
37620 228.22 1
33013 323.75 2
19319 360 3
6211 750 4
31814 813.75 5
28820 982.6588 6
17905 993.0207 7
10022 1122.5 8
5116 1145.833 9
7521 1151.435 10
6105 1193.125 11
32410 1274.714 12
5218 1278 13
9920 1278 14
36517 1328.5 15
9614 1375 16
6203 1395 17
6213 1448.333 18
7206 1460 19
32414 1470 20
I would appreciate any help.
Thanks for your time.
Ana Rios �
*
* 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/