Created
June 7, 2024 19:53
-
-
Save larsvilhuber/af4a5d990d2735d13aa78bc0b14f6b3e to your computer and use it in GitHub Desktop.
Downloading files from IPEDS (untested)
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
// Create a program to download IPDS Completion data files | |
// The program will check if the file exists and if it does, it will download the file | |
// If the file does not exist, it will print a message to the user | |
capture program drop download_ipeds_completion | |
program define download_ipeds_completion | |
version 17.0 | |
args year | |
local output "zips" | |
cap confirm dir "`output'" | |
if _rc != 0 { | |
display "Creating directory `output'" | |
cap mkdir "`output'" | |
} | |
local filename "C`year'_A.zip" | |
local ipedsurl "https://nces.ed.gov/ipeds/datacenter/data" | |
capture confirm file "`output'/`filename'" | |
if _rc == 0 { | |
display "File exists - skipping download" | |
} | |
else { | |
display "File does not exist - downloading" | |
copy "`ipedsurl'/`filename'" "`output'/`filename'" | |
} | |
end | |
foreach year in 2006 2007 { | |
download_ipeds_completion `year' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment