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
SAS Super FREQ

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
SAS Super FREQ

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

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