BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Tom
Super User Tom
Super User

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 

  1. The input dataset with the list of file names.
  2. The macro to not add the .xlsx.
  3. The data step to remove the .xlsx. 
wbsjd
Obsidian | Level 7

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 😥

ballardw
Super User

@wbsjd wrote:

The SAS Log show no error and is like this:

wbsjd_2-1687544761104.png

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;

 

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

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!

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
  • 17 replies
  • 5663 views
  • 4 likes
  • 4 in conversation