Hi All,
I am trying to do the following
- Download a Zip File from Web. I have done this using FILENAME URL - Working Fine
- Unzip the File and get all the member data. I have done this using FILENAME ZIP, DOPEN, DREAD and FOPEN in a DATA Step - Working Fine.
- Get the Last Updated TimeStamp of every member in the ZIP File. - This is the one I need help.
- When I tried to get the File Attributes (using FOPEN, FINFO) on the unzipped file, I get current date as I have created the file during the unzip process.
- When I tried to get the File Attributes (using FOPEN, FINFO) on the zip file immediately after download, File Identifier comes as ZERO.
Hope this makes.
Any help is appreciated.
Selva
Once you have downloaded the zip file (say as foo.zip), you can use unzip -l foo to list the contents of the zip file:
Archive: foo.zip
Length Date Time Name
-------- ---- ---- ----
29 09-10-13 08:32 test.dat
37 03-04-14 13:04 xxx.lst
72949 11-14-12 14:39 wagner.log
-------- -------
73015 3 files
You can use a construct like this:
filename oscmd pipe "unzip -l foo"
data fileinfo;
infile oscmd truncover end=last;
format file_name $50. file_date date9. file_time time5.;
input;
if _n_ > 3 and not last and substr(_infile_,2,8) ne '--------';
file_date = input(substr(_infile_,12,8),mmddyy8.);
file_time = input(substr(_infile_,21,5),time5.);
file_name = substr(_infile_,29);
run;
unzip is a standard tool on UNIX systems.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.