BookmarkSubscribeRSS Feed
Tom
Super User Tom
Super User

Note that XLSX files are BINARY files.  You need to add RECFM=N to your FILENAME statements.

 

Example:

filename xx "%sysfunc(pathname(work))/test1.xlsx" recfm=n;
filename yy "c:\downloads\test2.xlsx" recfm=n;
ods excel file=xx ;
proc print data=sashelp.class; run;
ods excel close;
%let rc=%sysfunc(fcopy(xx,yy));
%put &=rc;
David_Billa
Rhodochrosite | Level 12

@Tom that's great. Is this the alternate solution when compared to @Kurt_Bremser program which he posted before. So recfm=n is not required when I consider to use the Kurt's approach?

Tom
Super User Tom
Super User

@David_Billa wrote:

@Tom that's great. Is this the alternate solution when compared to @Kurt_Bremser program which he posted before. So recfm=n is not required when I consider to use the Kurt's approach?


No sure what you mean. RECFM=N is needed if you want SAS to COPY the file for you using the FCOPY() function. Otherwise it will copy it as text and mangle it.  If you are asking the operating system to copy the file then you don't need to specify RECFM=N as SAS will make the file properly without it.

David_Billa
Rhodochrosite | Level 12

@Tom Here are we copying the file from the xx folder to yy folder?

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
  • 18 replies
  • 4682 views
  • 7 likes
  • 3 in conversation