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;
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.
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.
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.
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!
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.
Ready to level-up your skills? Choose your own adventure.