BookmarkSubscribeRSS Feed
Leo9
Quartz | Level 8

Hi All,

 

I am trying to read zip file which has lot of sas datasets. I want to extract all this sas datasets at once and placed them in a folder.

I am successful in reading the content of zip file but not sure how to extract sas datasets from this zip file and placed them in a different folder. Below is the code which reads content of zip file. 


filename inzip ZIP "x:\test.zip";

DATA FLS(KEEP=MEMNAME);
FILENAME inzip ZIP "x:\test.zip";
LENGTH MEMNAME $200;
FID=DOPEN("inzip");
IF FID=0 THEN
STOP;
MEMCOUNT=DNUM(FID);
DO I=1 TO MEMCOUNT;
MEMNAME=DREAD(FID,I);
OUTPUT;
END;
RC=DCLOSE(FID);
RUN;


proc print data = fls ;
run;

4 REPLIES 4
Reeza
Super User
If you google the topic with Chris Hemidinger name you'll find several fully worked examples in his blog posts, including some macros to help automate the tasks..
Leo9
Quartz | Level 8

I could not fine anything which specifically does this task. I example of reading excel file and reading one dataset at a time but nothing related to what I need. 

Reeza
Super User

I'd recommend taking the example that does one file and figure out how to generalize it to all. 

X commands definitely work though. 

 


@Leo9 wrote:

I could not fine anything which specifically does this task. I example of reading excel file and reading one dataset at a time but nothing related to what I need. 


 

ballardw
Super User

My approach to something like this would be to

1) us appropriate tool to unzip to desired location with system tools.

2) assign a library to that location.

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 871 views
  • 0 likes
  • 3 in conversation