Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Sophie Jensen <thorns.n.roses@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: Merging two data sets and matching on distance |
Date | Mon, 4 Oct 2010 23:25:35 +0100 |
Dear Stata users, I'm trying to match two data sets together using LEA code (in England each area has a local education authority (LEA) that is responsible for providing funding and money for certain schools in the area). The problem is the data sets are slightly different and they have different numbers of observations for each variable. I was wondering how I would go about matching using one of the common variable (the problem is I'm not sure that all of the inputs are not exactly the same but almost similar.) The other thing I wanted to ask was how I would construct area space in Stata using a northing and easting points from each particular school. I would like to do two things with this, the first is after having found the radius area around each school, construct similar areas around each lea with wage data and then match the average wage in that area with school radii areas - does this make sense? My goal is therefore to find the average wage around each school. I would like to do this for several distances around the school. So far to create the school areas, I have used pythagoras theorem to generate the areas. So far the code I have used has been succesful in creating a radius around the school.. gen school_distance=(((sch_ northing-lea)^2) + ((sch_easting - lea)^2))^0.5 .... but for some reason the rest doesnt work: gen within60km=0 replace within60km=1 if ((((sch_easting-outwage_male)^2) + (sch_northing-outwage_male)^2)^0.5)<60 . I want to match schools to an average wages in the radius around each school. Related to this, I was also wondering if I could find out how many schools are within each radius of a school to determine competition... is there a way I could translate this onto a map, or a point? I hope you've understood what I've said ( I know its very confusing!) and can help out. Also, I am using Stata 10 and 11. I would appreciate any help you can offer. Thanks a lot * * 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/