SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
buechler66
Barite | Level 11

Hi.  I'm wondering if there is a way to name the Tab that is created within Excel that holds my Proc Report output?  Right now it's getting populated with something by default.

 

Any help would be much appreciated.

 

/* EXPORT THE FILE TO XLS USING ODS */
OPTION MISSING = '';
ODS EXCEL FILE="C:\USERS\STEVEBUECHLER\BOX SYNC\IBM\USPS\HRC PAY DATA ANALYSIS\&SITE._HCR_PD_SUMMARY.XLSX";
PROC REPORT DATA=&SITE._HCR_SUMMARY_F;
title "&site_nm HCR Pay Data Summary";

define area  / style(column)=[cellwidth= 2in] ;

COMPUTE AREA;
      IF FIND(AREA,"AREA SITE GRAND TOTAL") THEN
      CALL DEFINE(_ROW_, "STYLE", "STYLE=[FONTWEIGHT=BOLD
                                          FOREGROUND=BLUE]");
ENDCOMP;
COMPUTE PAY_DATA_MONTH_CHR;
      IF FIND(PAY_DATA_MONTH_CHR,"HCR CONTRACT TOTAL") THEN
      CALL DEFINE(_ROW_, "STYLE", "STYLE=[FONTWEIGHT=BOLD
                                          BACKGROUND=HONEYDEW]");
ENDCOMP;
COMPUTE ACTIVITY_DESCRIPTION;
      IF FIND(ACTIVITY_DESCRIPTION,"CONTRACT SUBTOTAL") THEN
      CALL DEFINE(_COL_, "STYLE", "STYLE=[FONTWEIGHT=BOLD
	                                      FOREGROUND=DARKGREEN
                                          BACKGROUND=HONEYDEW]");
ENDCOMP;
COMPUTE FREQ;
      IF FIND(ACTIVITY_DESCRIPTION,"CONTRACT SUBTOTAL") THEN
      CALL DEFINE(_COL_, "STYLE", "STYLE=[FONTWEIGHT=BOLD
	                                      FOREGROUND=DARKGREEN
                                          BACKGROUND=HONEYDEW]");
ENDCOMP;
COMPUTE PAY_AMOUNT;
      IF FIND(ACTIVITY_DESCRIPTION,"CONTRACT SUBTOTAL") THEN
      CALL DEFINE(_COL_, "STYLE", "STYLE=[FONTWEIGHT=BOLD
	                                      FOREGROUND=DARKGREEN
                                          BACKGROUND=HONEYDEW]");
ENDCOMP;
COMPUTE RATE_PER_UNIT;
      IF FIND(ACTIVITY_DESCRIPTION,"CONTRACT SUBTOTAL") THEN
      CALL DEFINE(_COL_, "STYLE", "STYLE=[FONTWEIGHT=BOLD
	                                      FOREGROUND=DARKGREEN
                                          BACKGROUND=HONEYDEW]");
ENDCOMP;
COMPUTE UNITS;
      IF FIND(ACTIVITY_DESCRIPTION,"CONTRACT SUBTOTAL") THEN
      CALL DEFINE(_COL_, "STYLE", "STYLE=[FONTWEIGHT=BOLD
	                                      FOREGROUND=DARKGREEN
                                          BACKGROUND=HONEYDEW]");
ENDCOMP;
COLUMNS _ALL_;
RUN;
ODS EXCEL CLOSE;
1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

There are dozens of options in ODS EXCEL, and you would be wise to familiarize yourself with them.

https://documentation.sas.com/?docsetId=odsug&docsetTarget=p09n5pw9ol0897n1qe04zeur27rv.htm&docsetVe...

 

In particular, to answer your question

 

ods excel file="whatever.xlsx" options(sheet_name='Fred Flintstone');

--
Paige Miller

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26

There are dozens of options in ODS EXCEL, and you would be wise to familiarize yourself with them.

https://documentation.sas.com/?docsetId=odsug&docsetTarget=p09n5pw9ol0897n1qe04zeur27rv.htm&docsetVe...

 

In particular, to answer your question

 

ods excel file="whatever.xlsx" options(sheet_name='Fred Flintstone');

--
Paige Miller
buechler66
Barite | Level 11
Thanks for your help again! I really appreciate it. And thanks for the documentation link too.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

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
  • 1787 views
  • 4 likes
  • 3 in conversation