Created
May 14, 2015 23:03
-
-
Save citizenrich/7497c59951fbc326698c to your computer and use it in GitHub Desktop.
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
cd "~/Dropbox/Datasets/DHSbr/archives/" | |
fsx *.ZIP *.zip | |
foreach file in `r(files)' { | |
capture unzipfile `file', replace | |
fsx *.DTA *.dta | |
local data `r(files)' | |
use `data', clear | |
describe, short | |
//Clean up the files that were unzipped. | |
//The shell command should be changed for the operating system, this is Mac/UNIX/Linux. | |
foreach doc in DOC FRW FRQ MAP doc frw frq map pdf PDF { | |
capture shell rm -rf *.`doc' | |
} | |
capture rm CASTE.ZIP | |
capture shell rm -rf `data' | |
} | |
cd "~/Dropbox/Datasets/DHSbr/archives/" | |
fsx *.ZIP *.zip | |
foreach file in `r(files)' { | |
capture unzipfile `file', replace | |
fsx *.DTA *.dta | |
local data `r(files)' | |
use `data', clear | |
// | |
quietly capture dropmiss *, force | |
//The variable h36a is for whatever variable one chooses to see if it exists with non-empty observations. | |
capture confirm variable h36a | |
if !_rc { | |
display in green "Variable[s] exist" | |
tab h36a | |
} | |
else { | |
display in red "variables do not exist" | |
} | |
//Clean up the files that were unzipped. | |
//The shell command should be changed for the operating system, this is Mac/UNIX/Linux. | |
foreach doc in DOC FRW FRQ MAP doc frw frq map pdf PDF { | |
capture shell rm -rf *.`doc' | |
} | |
capture rm CASTE.ZIP | |
capture shell rm -rf `data' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment