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. 

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!

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
  • 3 replies
  • 1153 views
  • 1 like
  • 2 in conversation