Dear All,
I am trying to use -zipuse- to use and append a number of files that are inside some zip folders contained in a specific directory. Each zip folder contains one .dta file and the name of the .dta files that are inside the zip folders are a random list of digits and characters (e.g. aa48229snfjka.dta). Before giving further details, I'd like to specify that I am using Stata 13 on Windows 10, and that both Stata and the operating system are up to date.
The code I have been trying to use is the following:
When I run this code, as soon as -zipuse- tries to use the first zip file, Stata gives the following error--this is what the trace shows. (I am just reporting the part of the log where the error is generated.)
In practice, it means that the file inside the zip folder is not in Stata format, but I can guarantee that it is since I can open it manually. The developer of -zipsave- argues that to make sure that the package works at all, one should try to zip a random Stata file using -zipsave-. I tried that and, unfortunately, also that doesn't work. Specifically, -zipsave- creates a zip file, but when I try to open it manually using Windows File Explorer, the file contains some nested folders and a file that cannot be opened with any app. Another thing a user should do to check whether -zipsave/zipuse- work is to enter the code:
This should return a meaningful path. Perhaps it is needless to say that this also doesn't work--no meaningful path is returned. What the developer of the package suggests then if -zipsave- doesn't work is to install Info Zip (http://infozip.sourceforge.net/). Yet, Info Zip doesn't seem to be supported on Windows 10. I tried to install it anyway, but this doesn't change the situation.
I hope someone can offer advice or a workaround to avoid using zipuse altogether.
I am trying to use -zipuse- to use and append a number of files that are inside some zip folders contained in a specific directory. Each zip folder contains one .dta file and the name of the .dta files that are inside the zip folders are a random list of digits and characters (e.g. aa48229snfjka.dta). Before giving further details, I'd like to specify that I am using Stata 13 on Windows 10, and that both Stata and the operating system are up to date.
The code I have been trying to use is the following:
Code:
local sourcedir "C:/DocumentiRV/ERIM/research/writing/ownership characteristics and tax inversions/2020/data/shareholder information" local fls : dir "`sourcedir'" files "*people.zip", respectcase local flsC : dir "`sourcedir'" files "*companies.zip", respectcase tempfile people companies save `people', emptyok save `companies', emptyok foreach f of local fls { zipuse "`sourcedir'/`f'", clear append `people' save `people', replace } foreach fC of local flsC { zipuse "`sourcedir'/`fC'", clear drop annualreportdate rowtype duplicates drop append `companies' save `companies', replace } merge m:1 directorid using `people', nogen zipsave "`sourcedir'/BoardEx All"
Code:
----------------------------------------------------------------------- end zipuse._ok2use --- - tempfile tmpdat - if "`dtafile'" == "" { = if "" == "" { - shell unzip -p "`zipfile'" > `tmpdat' = shell unzip -p "C:/DocumentiRV/ERIM/research/writing/ownership characteristics and tax inversi > ons/2020/data/shareholder information/BoardEx Europe people.zip" > C:\Users\RICCAR~1\AppData\Loc > al\Temp\ST_02000003.tmp - } - else { shell unzip -p "`zipfile'" "`dtafile'" > `tmpdat' } - use `initlist' `usind' `tmpdat', clear `options' = use C:\Users\RICCAR~1\AppData\Local\Temp\ST_02000003.tmp, clear file C:\Users\RICCAR~1\AppData\Local\Temp\ST_02000003.tmp not Stata format if "`dtafile'" == "" { global S_FN = "`zipfile'" } else { global S_FN = "`dtafile'" } } --------------------------------------------------------------------------------- end zipuse ---
Code:
shell which zip
I hope someone can offer advice or a workaround to avoid using zipuse altogether.