Skip to content

Commit 4006f22

Browse files
authored
Merge pull request #134 from worldbank/develop
The new version is online and includes all commands.
2 parents 5ab2242 + 8a8e6fb commit 4006f22

22 files changed

+3696
-3101
lines changed

src/ado_files/iebaltab.ado

Lines changed: 1322 additions & 1021 deletions
Large diffs are not rendered by default.

src/ado_files/ieboilsave.ado

Lines changed: 77 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,169 +1,169 @@
1-
*! version 5.4 15DEC2017 DIME Analytics lcardosodeandrad@worldbank.org
2-
3-
capture program drop ieboilsave
1+
*! version 5.5 26APR2018 DIME Analytics lcardosodeandrad@worldbank.org
2+
3+
capture program drop ieboilsave
44
program ieboilsave , rclass
5-
5+
66
syntax , IDVARname(varlist) [DIOUTput missingok tagnoname tagnohost]
7-
7+
88
qui {
9-
9+
1010
preserve
11-
11+
1212
local origversion "`c(version)'"
13-
13+
1414
version 11.0
15-
15+
1616
//Checking that only one id variable is listed
1717
if `:list sizeof idvarname' > 1 {
18-
18+
1919
noi di as error "{phang}Multiple ID variables in idvarname(`idvarname') are not allowed. While it is not always incorrect, it is bad practice, see {help ieboilsave##IDnotes:Notes on ID variables} for more details.{p_end}"
2020
noi di ""
2121
error 103
2222
exit
2323
}
24-
25-
24+
25+
2626
/*********************************
27-
27+
2828
ID variables
29-
29+
3030
*********************************/
31-
31+
3232
capture isid `idvarname'
33-
33+
3434
if _rc {
35-
36-
35+
36+
3737
//Test missing
3838
capture assert !missing(`idvarname')
3939
if _rc {
40-
40+
4141
count if missing(`idvarname')
42-
42+
4343
noi di as error "{phang}The ID variable `idvarname' is missing in `r(N)' observation(s). The ID variable needs to be fully identifying, meaning that no values can be a missing values (., .a, .b ... .z) or the empty string{p_end}"
4444
noi di ""
4545
}
46-
46+
4747
//Test duplicates
4848
tempvar iedup
49-
49+
5050
duplicates tag `idvarname', gen(`iedup')
51-
51+
5252
count if `iedup' != 0
53-
53+
5454
if r(N) > 0 {
55-
55+
5656
sort `idvarname'
57-
57+
5858
noi di as error "{phang}To be uniquely identifying the ID variable should not have any duplicates. The ID variable `idvarname' has duplicate observations in the following values:{p_end}"
5959
noi list `idvarname' if `iedup' != 0
6060
}
6161
noi di ""
6262
error 148
6363
exit
64-
}
65-
66-
67-
64+
}
65+
66+
67+
6868
/*********************************
69-
69+
7070
Missing values
71-
71+
7272
*********************************/
73-
73+
7474
if "`missingok'" == "" {
75-
76-
local varsStandMiss
77-
75+
76+
local varsStandMiss
77+
7878
ds, has(type numeric)
79-
79+
8080
foreach variable in `r(varlist)' {
81-
81+
8282
cap assert `variable' != .
83-
83+
8484
if _rc {
85-
85+
8686
local varsStandMiss `varsStandMiss' `variable'
8787
}
8888
}
89-
89+
9090
if `:list sizeof varsStandMiss' > 0 {
91-
91+
9292
noi di as error "{phang}There are `:list sizeof varsStandMiss' numeric variable(s) that contains the standard missing value (.) which is bad practice. A list of the variable(s) are stored in the local {cmd:r(standmissvars)}. Extended missing variables should be used. See {help ieboilsave} for more details.{p_end}"
93-
93+
9494
return local standmissvars "`varsStandMiss'"
95-
95+
9696
error 416
9797
exit
9898
}
9999
}
100-
101-
restore
102-
100+
101+
restore
102+
103103
/*********************************
104-
104+
105105
Output success messages
106-
107-
*********************************/
108-
106+
107+
*********************************/
108+
109109
// ID
110-
110+
111111
//Store the name of idvar in data set char and in notes
112112
char _dta[ie_idvar] "`idvarname'"
113-
113+
114114
local idOut "The uniquely and fully identifying ID variable is `idvarname'. "
115-
116-
117-
// Version
115+
116+
117+
// Version
118118
char _dta[ie_version] "`origversion'"
119-
119+
120120
local versOut "This data set was created in Stata version `origversion'"
121-
121+
122122
// Date
123123
char _dta[ie_date] "`c(current_date)'"
124-
124+
125125
local dateOut " on `c(current_date)'."
126-
127-
// Name
128-
126+
127+
// Name
128+
129129
local nameOut ""
130130
local hostOut ""
131-
131+
132132
if "`tagnoname'" == "" {
133-
133+
134134
char _dta[ie_name] "`c(username)'"
135-
135+
136136
if "`tagnohost'" == "" {
137-
137+
138138
char _dta[ie_host] "`c(hostname)'"
139139
local hostOut ", by user `c(username)' using computer `c(hostname)',"
140140
}
141141
else {
142-
142+
143143
local nameOut ", by user `c(username)',"
144-
144+
145145
}
146146
}
147147
// Missing vars
148-
148+
149149
if "`missingok'" == "" {
150-
150+
151151
local missOut "There are no regular missing values in this data set"
152152
}
153153
else {
154-
154+
155155
local missOut "This data set was not tested for missing values"
156156
}
157-
157+
158158
char _dta[ie_boilsave] "ieboilsave ran successfully. `idOut'`versOut'`nameOut'`hostOut'`dateOut' `missOut'"
159-
159+
160160
if "`dioutput'" != "" {
161-
161+
162162
local outputSum : char _dta[ie_boilsave]
163163
noi di ""
164164
noi di "{phang}`outputSum'{p_end}"
165-
165+
166166
}
167-
167+
168168
}
169-
end
169+
end

0 commit comments

Comments
 (0)