BookmarkSubscribeRSS Feed
Sassy_lady
Obsidian | Level 7

This is the code generated from the lesson and it opens in Excel

 

ods excel file="&outpath/StormStats.xlsx"
    style=snow
    options(sheet_name='South Pacific Summary');
ods noproctitle;

proc means data=pg1.storm_detail maxdec=0 median max;
    class Season;
    var Wind;
    where Basin='SP' and Season in (2014,2015,2016);
run;

ods excel options(sheet_name='Detail');

proc print data=pg1.storm_detail noobs;
    where Basin='SP' and Season in (2014,2015,2016);
    by Season;
run;

ods excel close;
ods proctitle;

This is the code that I created and it doesn't open in Excel

 

ods excel file="&outpath/StormStats.xlxs"
 style=snow
 options(sheet_name='South Pacific Summary');
ods noproctitle;

proc means data=pg1.storm_detail maxdec=0 median max;
    class Season;
    var Wind;
    where Basin='SP' and Season in (2014,2015,2016);
run;

ods excel options(sheet_name='Detail');

proc print data=pg1.storm_detail noobs;
    where Basin='SP' and Season in (2014,2015,2016);
    by Season;
run;
ods excel close;
ods proctitle;

I'm not sure what I am doing wrong.

2 REPLIES 2
Tom
Super User Tom
Super User

What do you mean by does not open?

Did you expect it to automatically start Excel for you?  How are you running the SAS code?  Are you running SAS on your PC?  Or are you using some front end tool to submit the SAS code, such as Enterprise Guide or a browser connected to a SAS/Studio installation?

 

Or did you actually try to open the resulting file with Excel and it did not work?  What error message did Excel give?

 

Did the SAS log have any error messages?  Did the PROC steps actually produce output?  Perhaps none of the observations met the WHERE condition you imposed.  That would create an empty XLSX file, which would not be readable by Excel.

 

ballardw
Super User

What does your log show when you run the code?

When you get unexpected behavior it is best to copy the text from the LOG and then paste the log text into a text box.

 

You might find issues with file paths, such as does not exist or invalid. Did you update the OUTPATH macro variable? without a correct value then the file system doesn't know where you intend to write the file.

 

Have you created all the data sets from the course set up instructions?

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

LIBNAME 101

Follow along as SAS technical trainer Dominique Weatherspoon expertly answers all your questions about SAS Libraries.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 668 views
  • 2 likes
  • 3 in conversation