forked from pma-training/Undo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CCRX_ReinterviewSelection.do
94 lines (63 loc) · 2.82 KB
/
CCRX_ReinterviewSelection.do
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
The purpose of this do file is to select households for reinterview.
1. Update the macros below to be country and round specific
2. Update the EA that you are selecting
3. Update the variable names that you want to export and keep
4. The information will export to an excel spreadsheet with the EA name/number
5. Send that information to the supervisor. They will need to complete the entire
reinterview questionnaire but will be able to directly compare some information
in the field.
**Use the combined dataset with names to identify households for selection
for reinterview.
*May 2, 2016 updated error to get geographic identifiers to export
*/
*******************************************************************************
* SET MACROS: UPDATE THIS SECTION FOR EACH EA THAT NEEDS RE_INTERVIEW INFORMATION
*******************************************************************************
*Dataset date - this is the date of the data you are using to select the
*the households to reinterview
local datadate 2May2016
*Update the EA name/number
local EA "Odapu_Ogaji"
*******************************************************************************
* SET MACROS: UPDATE THIS SECTION FOR EACH COUNTRY/ROUND - ONLY NEEDS TO BE DONE ONCE
*******************************************************************************
*BEFORE USE THE FOLLOWING NEED TO BE UPDATED:
*Country
local Country Nigeria
*Round Number
local Round Round3
*Country and Round Abbreviation
local CCRX NGR3
*Combined Dataset Name (must be the version with names)
local CombinedDataset `CCRX'_Combined_`datadate'.dta
*Geographic Identifier
global GeoID "state LGA Locality EA"
*Geographic Identifier lower than EA to household
global GEOID_SH "structure household"
*variables to keep
local varstokeep "RE firstname gender age eligible usual last_night"
**Directory where the Combined dataset is stored
global datadir "/Users/pma2020/Dropbox (Gates Institute)/Nigeria/Data_NotShared/Round3/Data/HHQFQ"
**Directory where the excel files will be exported to
global selectiondir "/Users/pma2020/Dropbox (Gates Institute)/Nigeria/Data_NotShared/Round3/Data/Selection"
*******************************************************************************************
******* Stop Updating Macros Here *******
*******************************************************************************************
cd "$selectiondir"
set seed 7261982
use "$datadir/`CombinedDataset'", clear
tempfile completetemp
save `completetemp', replace
keep if EA=="`EA'"
keep if metatag==1
sample 5, count
gen reinterview=1
tempfile temp
keep metainstanceID reinterview
save `temp', replace
use `completetemp', clear
merge m:1 metainstanceID using `temp', nogen
keep if reinterview==1
keep $GeoID $GeoID_SH `varstokeep'
export excel using `CCRX'_ReinterviewInformation_`EA'.xls, firstrow(variables) replace