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

Is there a way to remove the border when outputting the log into ODS EXCEL? I'm running SAS 9.4 M4. 

 

for_sas_com.png

 

Code:

 

filename test "K:\SAS\logs\log.log";
proc printto log=test new; run;

ODS excel file="K:\SAS\logs\test.xlsx" options(sheet_interval="none");
	proc printto;run;
	proc document name=mydoc(write);
		import textfile=test to logfile;run; 
		replay;run;
	quit;
ODS excel close;

I tried the following styles to no avail as well as the grindlines="no" option.

 

proc template;
  define style styles.test;
     parent=styles.default;
         style table from table /
            borderwidth=0
            cellspacing=0;
  end;
run;

proc template;
	define style styles.noborder;
		class table /
			borderwidth=0
			rules=none
			frame=void
			cellspacing=0
			background=white;
	end;
run;

Any help is appreciated. Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisNZ
Tourmaline | Level 20

This works:

filename test "%sysfunc(pathname(WORK))\log.log";
proc printto log=test new; run;
data T; run;
proc printto;run;

ODS excel file="%sysfunc(pathname(WORK))\test.xlsx" options(sheet_interval="none");
data  _null_;
  if _n_ = 1 then do;
    declare odsout ODS();
  end; 
infile "%sysfunc(pathname(WORK))\log.log";
input; ODS.format_text(data: _infile_); run; ODS excel close;

Capture.PNG

 

View solution in original post

3 REPLIES 3
ChrisNZ
Tourmaline | Level 20

This works:

filename test "%sysfunc(pathname(WORK))\log.log";
proc printto log=test new; run;
data T; run;
proc printto;run;

ODS excel file="%sysfunc(pathname(WORK))\test.xlsx" options(sheet_interval="none");
data  _null_;
  if _n_ = 1 then do;
    declare odsout ODS();
  end; 
infile "%sysfunc(pathname(WORK))\log.log";
input; ODS.format_text(data: _infile_); run; ODS excel close;

Capture.PNG

 

pkfamily
Obsidian | Level 7

Thanks for the solution! I'm a bit new to the ODS language but I'm guessing your method reads in a log text file which is then outputted into ODS inside a data step. And the format_text function removes the borders for some reason.

ChrisNZ
Tourmaline | Level 20

I am discovering the ODSOUT object too. It looks very useful. 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 1763 views
  • 1 like
  • 2 in conversation