BookmarkSubscribeRSS Feed
SelvaN
Fluorite | Level 6

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

1 REPLY 1
Kurt_Bremser
Super User

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.


sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 1073 views
  • 0 likes
  • 2 in conversation