BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Phil_NZ
Barite | Level 11

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.

 

Phil_NZ_1-1617240875558.png

When I opened the file, what displays is:

Phil_NZ_2-1617241138072.png

 

 

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

Phil_NZ_0-1617241055247.png

 

Could you please explain it to me and help me to sort it out?

Warmest regards.

 

 

Thank you for your help, have a fabulous and productive day! I am a novice today, but someday when I accumulate enough knowledge, I can help others in my capacity.
1 ACCEPTED SOLUTION

Accepted Solutions
qoit
Pyrite | Level 9
It mentions that your EXCEL WORKBOOK Name is "Storm.xlsx" and the Sheet Name is "Storm_Final". The code looks pretty good to me.

View solution in original post

5 REPLIES 5
qoit
Pyrite | Level 9
It mentions that your EXCEL WORKBOOK Name is "Storm.xlsx" and the Sheet Name is "Storm_Final". The code looks pretty good to me.
Phil_NZ
Barite | Level 11

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.

Thank you for your help, have a fabulous and productive day! I am a novice today, but someday when I accumulate enough knowledge, I can help others in my capacity.
qoit
Pyrite | Level 9
Quite unsure to be honest, from the code you have pasted above, there is no mention of a CSV output.
ballardw
Super User

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

Tom
Super User Tom
Super User

Your are not paying attention to the right part of your screen.

Check out the DATETIME value in your screen shot.

image.png

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 5 replies
  • 855 views
  • 4 likes
  • 4 in conversation