Statalist


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

st: RE: Data manipulation


From   "Kieran McCaul" <kamccaul@meddent.uwa.edu.au>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Data manipulation
Date   Wed, 23 Jul 2008 13:25:33 +0800

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: kamccaul@meddent.uwa.edu.au
http://myprofile.cos.com/mccaul 
_______________________________________________


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Ana R. Rios
Sent: Wednesday, 23 July 2008 12:58 PM
To: statalist@hsphsun2.harvard.edu
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/



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