Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
LCFS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ben Anderson
LCFS
Commits
107a46f0
Commit
107a46f0
authored
10 years ago
by
Ben Anderson
Browse files
Options
Downloads
Patches
Plain Diff
fixed variable checking
parent
7a35be5b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
ONS-UK-EFS-time-series-extract.do
+21
-5
21 additions, 5 deletions
ONS-UK-EFS-time-series-extract.do
with
21 additions
and
5 deletions
ONS-UK-EFS-time-series-extract.do
+
21
−
5
View file @
107a46f0
...
...
@@ -78,11 +78,14 @@ local do_extracts 1
* -> dvhh file
* basic weighting & consumption expenditure codes
local
dvhh_keepvars
=
"p60*t p61*t p630* p396*"
* p60*t p61*t p630*
local
dvhh_keepvars
=
""
* needed for income equivalisation later
local
dvhh_keepvars
=
"`dvhh_keepvars' incanon a055 g018 g019 p116* p344* p389*"
local
dvhh_keepvars
=
"`dvhh_keepvars' incanon a055 g018 g019 p116* p344* p389*
p396*
"
* DEMAND 2.3 (older people mobile lives)
local
dvhh_keepvars
=
"`dvhh_keepvars' b480 b481 b485 cc5413t c73312t"
// overseas travel expenditures
* DEMAND 3.1 (adapting infrastructures)
local
dvhh_keepvars
=
"`dvhh_keepvars' a103 a108 a128 a130 a15* a16* a1701 a1711"
// energy using appliances
* -> dvper file
local
dvper_keepvars
=
"case"
...
...
@@ -166,14 +169,27 @@ if `do_extracts' {
* construct list of vars to keep
* if dvhh_keepvars is empty STATA will skip
local
keepvars
=
""
foreach
v
of
varlist
`dvhh_keepvars'
{
foreach
v
of
local
dvhh_keepvars
{
di
"* Testing for existence of `v'"
capture
confirm
variable
`v'
if
!
_rc
{
*
di "* found `v'"
di
"* found `v'"
local
keepvars
=
"`keepvars' `v'"
}
else
{
di
in
red
"`v' does not exist in `y' - will be missing"
* exact string not found as a variable, could be because it needs expansion
* try as a varlist (forces expansion)
di
"* Not found, expanding `v'"
capture
noisily
{
* if variable really doesn't exist this throws an exception moves on
foreach
vt
of
varlist
`v'
{
capture
confirm
variable
`vt'
if
!
_rc
{
di
"* -> found `vt'"
local
keepvars
=
"`keepvars' `vt'"
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment