In order to make my do-files more easily replicable, I'm trying to include direct links to datasets downloaded from the Internet by using the copy command. I'm running into a problem when URLs don't actually include the file itself.
Consider the following: I go here and click the "SystemMembership2011.zip" link at the end of the page. This downloads a working .zip file. I right-click on the hyperlink and copy the link URL into my do file and use the copy command:
This adds a text file to the directory, but trying to open even that produces an error dialogue box.
Harvard's Dataverse also presents this problem. I go here and right-click on the "Download" button next to "Dyadic13undirected.dta." I copy that link URL and use the copy command:
This too downloads what looks like a Stata data file to the directory, but trying to open it results in the following error: "file ~/UNdata.dta not Stata format." I'begotten in touch with Dataverse's technical support, and there are plans to include permalinks directly to datasets in the future.
I want to know if there's any way to direct Stata to the file when the link doesn't point directly to it, or—more generally and less Stata-specific—if anyone knows how to find a permalink to a file when a hyperlink doesn't point directly to it.
Consider the following: I go here and click the "SystemMembership2011.zip" link at the end of the page. This downloads a working .zip file. I right-click on the hyperlink and copy the link URL into my do file and use the copy command:
Code:
copy "http://www.correlatesofwar.org/data-sets/state-system-membership/state-system-membership-zip/at_download/file" "COWsystem.zip"
Harvard's Dataverse also presents this problem. I go here and right-click on the "Download" button next to "Dyadic13undirected.dta." I copy that link URL and use the copy command:
Code:
copy "https://dataverse.harvard.edu/dataset.xhtml?persistentId=hdl:1902.1/12379#" "UNdata.dta"
I want to know if there's any way to direct Stata to the file when the link doesn't point directly to it, or—more generally and less Stata-specific—if anyone knows how to find a permalink to a file when a hyperlink doesn't point directly to it.
Comment