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;

 

 

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 17 replies
  • 3155 views
  • 4 likes
  • 4 in conversation