-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Freedom House 2016, Prefix variable labels to avoid collision,…
… Strip old dataset labels.
- Loading branch information
Showing
7 changed files
with
62 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
drop if year == . | ||
notes drop _dta | ||
label data | ||
|
||
rename UCINumeric country | ||
gen UCINumeric = country | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,42 @@ | ||
* 2015 Freedomhouse Freedom in the World Report | ||
* https://freedomhouse.org/report/freedom-world/freedom-world-2015 | ||
* 2016 Freedomhouse Freedom in the World Report | ||
* https://freedomhouse.org/report-types/freedom-world | ||
|
||
* If no cached file in source/ go here: | ||
local URL "http://mattpearce.name/files/fh2015.dta" | ||
local URL "https://raw.githubusercontent.com/mpearce/FH/master/FH2016.csv" | ||
* Prefix this source's variables with: | ||
local PREFIX "fh" | ||
* What is the year variable called in the source: | ||
local YEARVAR "year" | ||
* What is the country variable called in the source: | ||
local COUNTRYVAR "country" | ||
local COUNTRYVAR "UCINumeric" | ||
* Which set of ids are used, matching "source" field in UCIMergeList: | ||
local MERGEWITH "fh" | ||
local MERGEWITH "UCI" | ||
* In this example, the source already has a UCINumeric column. | ||
* The "UCI" source is a replication of the UCICountries codes. | ||
|
||
* Which field in UCIMergelist matches the country variable above (Name, Alpha or Numeric): | ||
local MERGEUSING "Name" | ||
local MERGEUSING "Numeric" | ||
|
||
* Create the merge file to use with this source | ||
tempfile merge | ||
prep_mergefile `MERGEWITH' `MERGEUSING' `merge' | ||
|
||
* If the file source file doesn't already exist then download and create it. | ||
use_or_import_source `PREFIX' `URL' | ||
use_or_import_source_csv `PREFIX' `URL' | ||
|
||
* Do any transformations/recodes/corrections here | ||
|
||
gen sum = cl + pr | ||
label variable sum "Combined Civil Liberties and Political Rights score." | ||
|
||
* Prefix the variables | ||
prefix `PREFIX' | ||
|
||
encode_value_labels fh_status | ||
|
||
* Combine the merge file IDs with the current source | ||
merge_ids `PREFIX' `YEARVAR' `COUNTRYVAR' `MERGEUSING' `merge' | ||
|
||
drop `PREFIX'_UCINumeric | ||
|
||
* Merge with the Dataset | ||
merge_with_master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters