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?
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.