BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Kevin_Viel
Obsidian | Level 7

If the file in a zip archive has a parenthesis, is it possible to unzip using the ZIP engine to the INFILE/FILE statements?

 

data _null_ ;
infile inzip(one/two/test (2).xpt) lrecl = 256 recfm = F length = length eof = eof unbuf ;
file unzip lrecl = 256 recfm = N ;
input ;
put _infile_ $varying256. length ;
return ;
eof: stop ;
run ;

 

In LSAF, I get the following messages:

 

   ERROR 23-2: Invalid option name .X.
   ERROR 23-2: Invalid option name PT.

 

Thank you,

 

Kevin

1 ACCEPTED SOLUTION

Accepted Solutions
SASJedi
Ammonite | Level 13

Because your file name includes special characters, you must enclose the member name in quotes. This should work:

data _null_ ;
   infile inzip("one/two/test(2) .xpt") lrecl = 256 recfm = F length = length eof = eof unbuf ;
   file unzip lrecl = 256 recfm = N ;
   input ;
   put _infile_ $varying256. length ;
   return ;
   eof: stop ;
run;
Check out my Jedi SAS Tricks for SAS Users

View solution in original post

3 REPLIES 3
SASJedi
Ammonite | Level 13

Because your file name includes special characters, you must enclose the member name in quotes. This should work:

data _null_ ;
   infile inzip("one/two/test(2) .xpt") lrecl = 256 recfm = F length = length eof = eof unbuf ;
   file unzip lrecl = 256 recfm = N ;
   input ;
   put _infile_ $varying256. length ;
   return ;
   eof: stop ;
run;
Check out my Jedi SAS Tricks for SAS Users
Reeza
Super User
We can assume the INZIP reference is provided somewhere?
Can you post your full code and log with error please?
Kevin_Viel
Obsidian | Level 7

Doh!

 

  The syntax is called aggregate syntax:

 

https://documentation.sas.com/?cdcId=vdmmlcdc&cdcVersion=8.1&docsetId=pgmcli&docsetTarget=n066409vu4...

 

The solution appears to be use parentheses:

 

data _null_ ;
infile inzip("one/two/test (2).xpt") lrecl = 256 recfm = F length = length eof = eof unbuf ;
file unzip lrecl = 256 recfm = N ;
input ;
put _infile_ $varying256. length ;
return ;
eof: stop ;
run 

 

Thank you,

 

Kevin

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 3 replies
  • 1537 views
  • 5 likes
  • 3 in conversation