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;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.