-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdtaformat.do
51 lines (39 loc) · 1.41 KB
/
dtaformat.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
/*****************************************************************
** ENAPRES: SPSS TO STATA FORMAT
**
** Author : Ronny M. Condor (ronny.condor@unmsm.edu.pe)
**
** Objective : Import the SPSS files and save as .dta files
**
** Inputs : RENADEF (all years).sav
**
** Output : RENADEF (all years).dta
**
** Comments : INEI publishs the RENADEF in SPSS format
******************************************************************/
*Folder structure
global root "G:\Mi unidad\La Rotonda Blog\Research\Criminalidad y desigualdad\03_data"
global raw "${root}\01_raw"
global raw_renadef "${raw}\renadef"
global raw_enaho "${enaho}\enaho"
global codes "${root}\02_codes"
global cleaned "${root}\03_cleaned"
global analysis "${root}\04_analysis"
global tables "${analysis}\01_tables"
global graphs "${analysis}\02_graphs"
global results "${root}\05_results"
/*-----------------------------------------------------------------------------
IMPORT SPSS FILES
------------------------------------------------------------------------------*/
*___________________________________
* CHAPTER 100: NUMBER OF DENUNCIAS
*___________________________________
forvalues yy = 2011(1)2017 {
if `yy' == 2012 {
di "RENADEF is not available in `yy'"
}
if `yy' == 2011 | `yy' >= 2013{
import spss using "$raw_renadef\cap100\\`yy'\\`yy'.sav", case(lower) clear
save "$raw_renadef\cap100\\`yy'\\`yy'.dta", replace
}
}