-
Notifications
You must be signed in to change notification settings - Fork 0
/
popdens.do
117 lines (96 loc) · 2.29 KB
/
popdens.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
var2 = var1([1:end], [1:10000]);
var3 = var1([1:end], [10001:20000]);
var4 = var1([1:end], [20001:30000]);
var5= var1([1:end], [30001:40000]);
var6= var1([1:end], [40001:end]);
dlmwrite('my_text', var2 , 'delimiter' , ',');
dlmwrite('my_text1', var3 , 'delimiter' , ',');
dlmwrite('my_text2', var4 , 'delimiter' , ',');
dlmwrite('my_text3', var5 , 'delimiter' , ',');
dlmwrite('my_text4', var6 , 'delimiter' , ',');
*/
set maxvar 11000
clear
gen x=.
save p1.dta, replace
local lower=1
local higher=100
import delimited \\nash\mtec-home\spichler\Desktop\gpw-v4-population-density-2000\my_text.txt, clear
forvalues i=1/100 {
preserve
keep v`lower'-v`higher'
gen x=_n
reshape long v, i(x) j(y)
replace v=. if v<=-4.076e+14 & v!=.
drop if v==.
append using p1.dta,
save p1.dta, replace
restore
local lower=`lower'+100
local higher=`higher'+100
}
clear
local lower=1
local higher=100
forvalues i=1/100 {
import delimited \\nash\mtec-home\spichler\Desktop\gpw-v4-population-density-2000\my_text1
keep v`lower'-v`higher'
gen x=_n
reshape long v, i(x) j(y)
replace y=y+10000
replace v=. if v<=-4.076e+14 & v!=.
drop if v==.
append using p1.dta,
save p1.dta, replace
local lower=`lower'+100
local higher=`higher'+100
}
clear
local lower=1
local higher=100
forvalues i=1/100 {
import delimited \\nash\mtec-home\spichler\Desktop\gpw-v4-population-density-2000\my_text2
keep v`lower'-v`higher'
gen x=_n
reshape long v, i(x) j(y)
replace y=y+20000
replace v=. if v<=-4.076e+14 & v!=.
drop if v==.
append using p1.dta,
save p1.dta, replace
local lower=`lower'+100
local higher=`higher'+100
}
clear
local lower=1
local higher=100
forvalues i=1/100 {
import delimited \\nash\mtec-home\spichler\Desktop\gpw-v4-population-density-2000\my_text3
keep v`lower'-v`higher'
gen x=_n
reshape long v, i(x) j(y)
replace y=y+30000
replace v=. if v<=-4.076e+14 & v!=.
drop if v==.
append using p1.dta,
save p1.dta, replace
local lower=`lower'+100
local higher=`higher'+100
}
clear
local lower=1
local higher=100
forvalues i=1/100 {
import delimited \\nash\mtec-home\spichler\Desktop\gpw-v4-population-density-2000\my_text4
keep v`lower'-v`higher'
gen x=_n
reshape long v, i(x) j(y)
replace y=y+40000
replace v=. if v<=-4.076e+14 & v!=.
drop if v==.
append using p1.dta,
save p1.dta, replace
local lower=`lower'+100
local higher=`higher'+100
}