BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ybz12003
Rhodochrosite | Level 12

Hello, 

I have the following codes for the Excel file output. However, the title and footnote aren't shown in the Excel file.  Please help.

 

%let bdate1=2004_01_14; /* The most updated date to extracted LIVD table */
%let bdate2=2014_02_17; /* The most updated date to extracted LOOKUP table */
%let footie=%str(LIVD as of &bdate1. & LOOKUP as of &bdate2.);
%let tdate=%sysfunc(today(), yymmddn8.); /* Generate today's date for filename */

ods excel file="Pathway\LIVD_LOOKUP_check_&tdate..xlsx";
  	options(sheet_interval="none" embedded_titles="yes" embedded_footnotes="yes" flow="tables");

ods excel options(sheet_name="LIVD");
Proc print data=LIVD_;
   Title "LIVD - &bdate1.";
run;

ods excel options(sheet_name="LOOPUP");
Proc print data=test_lookup; 
	title "LOOKUP - &bdate2.";;
run;

ods excel options(sheet_name="Unmatched_LIVD");
Proc print data=Unmatched_LIVD;
	title "Codes in LIVD but not in LOOPUP";
	footnote "&footie";
run;

ods excel options(sheet_name="Unmatched_LOOPUP");
Proc print data=Unmatched_Lookup;
	title "Codes in LOOPUP but not in LIVD";
	footnote "&footie";
run;

ods excel close;
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Did you get an error message when you ran that code?  What you posted has an extra semicolon that splits the first ODS EXCEL statement into two separate statements.  An ODS statement and an OPTIONS statement.

514  ods excel file="Pathway\LIVD_LOOKUP_check_&tdate..xlsx";
WARNING: Apparent symbolic reference TDATE not resolved.
515      options(sheet_interval="none" embedded_titles="yes" embedded_footnotes="yes" flow="tables")

-----------------------------------
                                                                                                   2
515! ;

ERROR 2-12: Invalid option name.

 

View solution in original post

3 REPLIES 3
Tom
Super User Tom
Super User

Did you get an error message when you ran that code?  What you posted has an extra semicolon that splits the first ODS EXCEL statement into two separate statements.  An ODS statement and an OPTIONS statement.

514  ods excel file="Pathway\LIVD_LOOKUP_check_&tdate..xlsx";
WARNING: Apparent symbolic reference TDATE not resolved.
515      options(sheet_interval="none" embedded_titles="yes" embedded_footnotes="yes" flow="tables")

-----------------------------------
                                                                                                   2
515! ;

ERROR 2-12: Invalid option name.

 

ybz12003
Rhodochrosite | Level 12
It's not like that, I fixed it by adding the option to each sheet output option.
Tom
Super User Tom
Super User

If it wasn't because the options did not run then it was because you told it NOT to make a new sheet. 

ods excel 
  file="c:\downloads\embedded_titles.xlsx"
	options(sheet_interval="none"
          embedded_titles="yes"
          embedded_footnotes="yes" 
          flow="tables")
;

ods excel options(sheet_name="MALES");
proc print data=sashelp.class;
  where sex='M';
  Title "Males Only";
run;

ods excel options(sheet_name="FEMALES");
proc print data=sashelp.class;
  where sex='F';
  Title "Females Only";
run;

ods excel close;

Tom_0-1734542951775.png

 

When you change the sheet name you need also tell it to start a new sheet.  So either set the SHEET_INTERVAL option to "PROC" or tell it start and new page when you change the name.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 836 views
  • 1 like
  • 2 in conversation