Hi all SAS Users,
I am following a learning structure, the code to write output to an excel file is as below
libname xl_lib xlsx "&outpath/storm.xlsx" ;
data xl_lib.storm_final;
set pg1.storm_final;
drop Lat Lon Basin OceanCode;
run;
libname xl_lib clear;
where &outpath is a predetermined global macro.
The code runs normally without any warnings or else. The thing here is: from the code, I expected that if I open the excel file storm_final, it should be an excel file. However, the story is different.
When I opened the file, what displays is:
As can be seen from the picture, the file storm_final is written under the CSV type rather than the excel file, which is different from what I expected.
The result from the instructor is
Could you please explain it to me and help me to sort it out?
Warmest regards.
Hi @qoit
Thank you for your point, I just checked and yes, it is correct.
Just wondering why SAS execute the code and resulted in the worksheet storm_final inside the workbook storm but also another csv storm_final outside the workbook storm as the picture above?
Warm regards.
Update: Maybe I created the csv file "storm_final" in advance that tricked my eyes. I try to delete the file csv storm_final, and rerun the code and it is good that the csv file storm_final no longer been created.
@Phil_NZ wrote:
Hi @qoit
Thank you for your point, I just checked and yes, it is correct.
Just wondering why SAS execute the code and resulted in the worksheet storm_final inside the workbook storm but also another csv storm_final outside the workbook storm as the picture above?
Warm regards.
Update: Maybe I created the csv file "storm_final" in advance that tricked my eyes. I try to delete the file csv storm_final, and rerun the code and it is good that the csv file storm_final no longer been created.
I was going to mention that the timestamp on the CSV in the picture you show is 15 minutes before the one on the Storm.Xlsx file. So likely an artifact of prior code you aren't showing.
Your are not paying attention to the right part of your screen.
Check out the DATETIME value in your screen shot.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.