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;
@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?
@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.
@Tom Here are we copying the file from the xx folder to yy folder?
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.