Then why did you call it from the data step with the extra .xlsx added?
From the photograph you posted of your SAS log your data step generated this command:
%zip(file_name=%nrstr(test.xlsx));
Instead of the the command you wanted:
%zip(file_name=%nrstr(test));
Fix one of the
You are right! It is because the extra .xlsx in the Macro....... After I remove the xlsx in the Macro, the code works as assumed. I should check it carefully 😥
@wbsjd wrote:
The SAS Log show no error and is like this:
I really don't know what's the issue.
I highlighted an error in your understanding above. Your output clearly shows RC=20006.
From the documentation of the FCOPY function, which is what your Put RC= would be printing from your %ZIP macro,
Values That Are Returned by the FCOPY Function
FCOPY returns these values:
a value of 0 if records were copied without errors or warnings a positive value if an error occurred a negative value if a warning was issued
The magenta is where you did not understand that your code was throwing an error.
Follow up with:
You can use the SYSMSG function to retrieve error or warning messages, and you can use the SYSRC function to retrieve the return code.
So you might use something like
if rc ne 0 then do; message=sysmsg(); put message; end;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.