The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Malaria » Nigeria Malaria Indicator Survey 2015
Re: Nigeria Malaria Indicator Survey 2015 [message #16050 is a reply to message #15818] Tue, 30 October 2018 13:45 Go to previous message
tfish-DHS is currently offline  tfish-DHS
Messages: 48
Registered: August 2017
Location: Maryland, USA
Member
I used the following STATA code to join between the GC (points) and the IR file
/******************************************************************************************
* Title: NigeriaMerge.do
* Created by: Tom Fish
* Created on: 30 October 2018
* Purpose: Explan how to merge an IR file with the GC (points) file in STATA
******************************************************************************************/
clear all
set more off

* Set folders that I am working on
local ptsDir "C:\Data\08_GPS\04_Completed_Surveys\Nigeria\Nigeria_2015_MIS\Upload_file\"
local dataDir "C:\Data\DHSdata\"
local working "C:\working\"

* Make sure we are working in our working directory
cd "`working'"

* Convert the shapefile into a dta file to merge in STATA
shp2dta using "`ptsDir'NGGE71FL.shp", database(ngpts) coordinates(ngcoord) genid(id)

* Open up the table portion of the shapefile
use ngpts

* Rename and sort to allow for the merge to be successful
rename DHSCLUST v001
sort v001

* Resave the table
save ngpts, replace

* Open the IR file
use "`dataDir'NGIR71FL.DTA", clear

* Do a 1 to Many merge/join between the points and the IR file
sort v001
merge v001 using ngpts.dta

* Show that the merge was 100% successful and then drop the unneed column
tab _merge
drop _merge id

* Save the merged file
save NG_Merged, replace

The merge was 100% successful
     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          3 |      8,034      100.00      100.00
------------+-----------------------------------
      Total |      8,034      100.00


4 of the 326 clusters are classified as missing and are found at (0, 0)

     SOURCE |      Freq.     Percent        Cum.
------------+-----------------------------------
        GPS |        322       98.77       98.77
        MIS |          4        1.23      100.00
------------+-----------------------------------
      Total |        326      100.00


I know that this is in STATA instead of SPSS, but this should be should be helpful.
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: 2014 Malawi MIS Survey
Next Topic: Zambia Household Possession of Mosquito Nets
Goto Forum:
  


Current Time: Fri Jan 31 04:54:09 Coordinated Universal Time 2025